"must specify image size" while convert rgba to png

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
webshaker
Posts: 16
Joined: 2007-07-25T15:42:25-07:00

"must specify image size" while convert rgba to png

Post 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 !!!
webshaker
Posts: 16
Joined: 2007-07-25T15:42:25-07:00

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

Post by webshaker »

Founded.

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

had solve my problem.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

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

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post by anthony »

For -depth 16 you may also need to specify -endian for the integer byte order used.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply