Convert PNG32s to PNG8s and with matted indexed transparency - imagemagick

We have a range of product images that have been clear cut by our graphic designers and have been saved as PNG32s with transparent backgrounds. We need to convert these to PNG8 as they are uploaded to the website (using ImageMagick) so the files are nice and small.
The images are displayed at various positions over a grey gradient background so they need to retain their transparency.
Because the PNG8s will have indexed transparency, we want to matte just the semi-transparent anti-aliased edge pixels with the average grey of the gradient.
What's the nicest way of doing this im ImageMagic? I've found lots of cool ways of transforming/removing/flattening the alpha channel but it doesn't help much with the task of targeting and matting only semi-transparent pixels. Anyone done this before?

Related

How can I efficiently change all black rectangles in a redacted and flattened PDF to white?

I would prefer that redactions appear as erased text and not as black rectangles.
The documents are already flattened, so there is no way to manipulate the redactions directly.
The only solution I have found is Photoshop, but doing this manually is prohibitively time-consuming.
How can I efficiently change all black rectangles in a PDF file to white?
Edit: examples.

Colors are opposite of what they should be on iPad

I have an original iPad.
I have noticed that certain sites/documents display in the opposite colors they should--a white background is black, a red image is green, a blue image is yellow.Now I have created a masthead in Photoshop using white, blue and green. It is a jpeg if that makes any difference.
On all of my devices it displays properly except on the iPad where it displays as black, gold, and purple--and totally clashes with everything else.
This is the site, if that helps--sorry I can't seem to insert it as a hyperlink. It is only a temp site, so this is not earth shattering, but I would like to know how to prevent this for future sites.
The image http://reformsbcounty.com/wp-content/uploads/2012/10/ReformHeader-copy2.jpg is using a CMYK colorspace. You should try to use a RGB colorspace for the web (24bit image). There is a fuss about JPEG CMYK color bytes which are stored inverted by PhotoShop (adding a special marker that not all JPEG consumers interpret) . 0% color is stored as 0xFF (and 100% as 0x00) while the standard is 0->0 100%->0xFF. So try converting your images as RGB images should give you a correct rendering on all devices.

XNA Strange blur on my transparency .png

(i can't post images so i posted links instead)
i'm working on a 2D platform game using pixelperfect.
The problem is about the png images used in-game. On transparency, there are some blur.
like this :
http://i.stack.imgur.com/lBX3A.jpg
If i open the texture with TheGimp, this is what i get :
http://i.stack.imgur.com/pOeF4.jpg
this is a sample of my map (zoom 1600x).
As you can see there is no blur around the black. (the grey squares means transparency).
Tests i did :
save without compression and re-opened it = no blur.
to be sure, i added a white background in gimp (it's easier to see the dark blur on white) :
(http://) i.stack.imgur.com/jfhWv.jpg
of course, i removed the white background because i wanted it transparency.
last information : there is blur on every transparency png images, even on my spritesheet character. When i animate it, i can see the blur from others frames.
After my tests, i concluded that gimp isn't the problem.
Can you help me ? Thx for reading.
xna4, c#2010 express edition, gimp2.611.
Sorry about my english ^^
This happens because of "texture filtering", which xna does by default.
You probaly can disable this.
found something: https://gamedev.stackexchange.com/questions/6820/how-do-i-disable-texture-filtering-for-sprite-scaling-in-xna-4-0

How to figure out, If an imagefile (base64) has transparency?

i wonder, how i could figure out if an image has a transparency effect applied. Is there any way in JavaScript or HTML5? I have a Base64-coded image. Is there a way to read out the transparency-information (alpha-channel). For example, if i load a PNG-Image, then convert it to base64, then drop it to html5-canvas, now how can i know if this has transparency-effect activated?
thanx alot
okyo
When you say 'drop it to html5-canvas', I assume you mean using an image element with the 'data:' URI scheme. Also, let's take it as given that you don't want to write javascript code to parse the image files.
You could do something like this pseudo-code:
create 2 off-screen canvases
color one opaque white and the other opaque black
draw the image on both of them
call getImageData on each canvas, using the image bounds
compare the image data
If the image has any transparent or partially-transparent pixels, then presumably the two canvases will end up at least a little different. One exception would be if the image has the transparency feature enabled but is entirely opaque anyway. Another would be if the non-opaque pixels are only very slightly transparent - not enough to alter a white or black background. But this technique would catch images where transparency is noticeable.

How to get great looking transparent PNGs on BlackBerry?

I am able to use PNGs that have drop shadows but the effect when displayed on the BlackBerry looks like it collapses the transparent channel down from its original smooth gradient to only several transparent values giving it a choppy look.
The same issue is encountered by drawing on the UI using BlackBerry fields or the graphics.drawBitmap method. Anyone want to share hints for getting great looking transparent effects on the BlackBerry?
Dither your images or pre-composite them. When loading an image on a BlackBerry, you get at most 4 bits of alpha data, which allows 4 bits each for RGB. So, if you want to dither your transparent images, go for RGB4444. If you don't dither them, that's what causes 8-bit alpha to just be mapped to the nearest 4-bit value.
If you include no alpha data (i.e., precomposite), you can get RGB565, which will have a better image quality overall, but you will have to deal with static positioning for your dropshadows.

Resources