Page 1 of 1

"must specify image size" while convert rgba to png

Posted: 2011-10-03T03:19:16-07:00
by webshaker
Hi.

I'm trying to convert a rgba to png file.
While there is no image size information into the rbga file, I have to give the information to convert.

I know my image resolution. it is a 256*256 images
my rgba image file size is exactly (256 *256 * 4 bytes)

I've tryed
convert -size 256x256 img.rgba img.png

I've then 2 problem.
First, I have this warning "convert: unexpected end-of-file `img.rgba': @ error/rgb.c/ReadRGBImage/232."
Second, Imagemagick made a png file, but the image is not correct.

I wonder if it's not a color depth problem !!!

Re: "must specify image size" while convert rgba to png

Posted: 2011-10-03T06:26:54-07:00
by webshaker
Founded.

It was effectively due to the pixel deph
convert -size 256x256 -depth 8 img.rgba img.png

had solve my problem.

Re: "must specify image size" while convert rgba to png

Posted: 2011-10-03T06:33:58-07:00
by glennrp
Right, the default depth for RGBA images is the quantum depth (Q8 or Q16) of your ImageMagick.
As you found,you can use the -depth option to override that.

Re: "must specify image size" while convert rgba to png

Posted: 2011-10-03T18:43:54-07:00
by anthony
For -depth 16 you may also need to specify -endian for the integer byte order used.