Png getting corrupted

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?".
gegupta
Posts: 30
Joined: 2010-12-03T12:14:09-07:00
Authentication code: 8675308

Re: Png getting corrupted

Post by gegupta »

GreenKoopa wrote:Again, I don't believe that there is any fault/bug. That 'corruption' is in the original image. You moved to a format with no alpha support without instructing ImageMagick how you wanted that handled.

Having an alpha channel gives an image the ability to do transparency. If an image has every pixel at 255 (no transparency), then the image is simply not using that ability,
This makes sense.
GreenKoopa wrote:Do you need something different, or are you simply curious to understand?
I was investigating an issue and things were not making sense. So I was mostly curious.

fmw42,
This happens with IE 6.2.8 as well as i mentioned earlier. Resize again keeps the image in same format which supports Alpha transperancy and hence doesnt affect. What in your view should ideally happen if you dont turn off Alpha and resize it?

Thanks

User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Png getting corrupted

Post by GreenKoopa »

fmw42 wrote: However, when I resize the Panasonic-RP-HS200-K-Black-vfr-detail.png it looks fine with the alpha channel, but when I turn off the alpha channel that odd part of the background turns black.

So something odd is happening, but I am not sure just yet what. As I said there have been some changes to PNG processing and this could be a side effect. Hopefully glennrp can look at this.
fmw42 wrote: The input image is what it is. Turning off the alpha channel leave behind what is there. However, I am concerned that when resizing by 50%, the output looks fine until you turn off the alpha channel. Then all the funny striped area, i.e. everything under the transparent areas turn black. I don't think that should happen. This is happening with IM 6.6.6.2 Q16 (hdri) Mac OSX Tiger
Great catch! Having explained one issue and created the output I was looking for, I totally missed your point. I never even attempted a -resize. Oops. Apparently we could all be more through readers.

Now I am seeing the blackness you describe. I tried Windows versions 6.6.6-3/2 (2010-12-01) and 6.6.5-8 (2010-11-10).

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Png getting corrupted

Post by fmw42 »

fmw42,
This happens with IE 6.2.8 as well as i mentioned earlier. Resize again keeps the image in same format which supports Alpha transperancy and hence doesnt affect. What in your view should ideally happen if you dont turn off Alpha and resize it?
Well, as far as I can tell, the result of the resize is fine if you don't turn off transparency. The image is just 50% smaller in width and height, but it looks the same to me. I don't see any problem with the current IM version. I am not sure what problem you are concerned about. But it is possible that with such an old version of IM, you are not getting the best results or perhaps a bug at that time.

The only issue I see is that when resized and the transparency is turned off, then the area where there was transparency turns black; whereas before the resize, it had a funny striped pattern, which I believe is actually in your image and not an IM issue.

Can you explain further what issue you are seeing with the original image and with the resized image before and after you turn off transparency?

Here is what I have before and after resize (IM 6.6.6.2 Q16 (hdri) Mac OSX Tiger):

original:
Image

original alpha off:
Image

original resized 50%:
Image

original resized50% alpha off:
Image

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

Re: Png getting corrupted

Post by glennrp »

I believe this is fixed in SVN head, to be in 6.6.6-3 soon. Look for 6.6.6-3 beta created later than 3 December. I think the problem only existed in the Q16 build.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Png getting corrupted

Post by fmw42 »

Thanks Glenn, I will look for the update when available and report back.

Fred

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Png getting corrupted

Post by fmw42 »

Glenn,

I am still getting the same result as above (black under transparent area) when doing:

convert Panasonic-RP-HS200-K-Black-vfr-detail.png -resize 50% -alpha off Panasonic-RP-HS200-K-Black-vfr-detail_test.png

IM 6.6.6.3 Q16 (hdri) Mac OSX Tiger

Fred

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Png getting corrupted

Post by anthony »

Transparency and the three most common file formats...

First saving to JPEG... You wnt to replace transparency with some specific color.
See IM examples Basics, Removing Alpha Channel
See http://www.imagemagick.org/Usage/basics/#alpha_remove

The second is if you actually want to make your PNG smaller by setting what the
fully-transparent color is in the PNG image (so it compresses better)
IM examples Basics, Set Alpha Background Color
http://www.imagemagick.org/Usage/basics ... background

And just to complete this trifecta for GIF images you can specify what color should be used for its representation of transparency in the color pallete (it can be a duplicate of an existing color)
See IM examples, Common File Formats, GIF Transparency Color
http://www.imagemagick.org/Usage/formats/#gif_trans
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Locked