How to get great looking transparent PNGs on BlackBerry? - 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.

Related

Is there a way to get the compression benefits of JPEG but with transparent pixels?

I have an iOS app that displays lots of thumbnails on the screen. It's a requirement that the thumbnails have a transparent background.
I store these images as PNG's so that I can get transparency, but all of the images are photographs, so JPEG compression would be perfect for this use case.
In testing, using JPEG's instead of PNG's cuts my disk usage by 90% on average and would reduce needless disk I/O. Unfortunately, I can't make the switch because I would lose the transparency information.
Is there a variant of JPEG (ideally, something that works with the iOS SDK) that allows me to compress photographic images but still keep transparent pixels? I don't actually need a full alpha channel - I just need some pixels to be fully transparent and some to be fully opaque.
I am told that it is possible to use a JPEG with a transparency mask using SVG. I also understand there is 3d party code to display SVG files in IOS.

How to Add PNG Image as Button Image in CMFCToolBar?

Seems like CMFCToolBar Allowing only BITMAP Images ( which are of color depth 24 ) to place on Buttons. How to get rid of this limitation. i am neither able to place a PNG nor a bit map with color depth 32 (alpha channel included).
i tried attaching my CPngImage to CBitmap but didn't work.
CPngImage image;
image.Load(AfxGetInstanceHandle(), IDB_PNG1);
bitmap.Attach(image.Detach());
so, finally my doubt can we add a PNG/ Bitmap with alpha channel to CMFCToolBar Button as Image?
Does this work: Icons on menus of MFC Feature Pack classes ? You'd probably have to adapt it a bit to get it to work in your specific case. I'd suggest staying away from using PNG for toolbar icons etc; you can use AlphaConv (google a bit to find it - it moves around a bit it seems) to convert from png to 32 bit bmp.

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.

Convert PNG32s to PNG8s and with matted indexed transparency

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?

Convert apng to gif with sufficiant resolution and color depth

I want to convert some animated PNG (APNG) images to animated GIF. I can successfully convert with a utility I found on the web called apng2gif. Expertly named if I may say. The problem is it does not convert the images with sufficient color depth so the output is a little bit to pixelated and not so smooth relative to the original.
Does anyone know of any other image converters that might convert APNG to GIF with more that 16 bit color depth?
The problem is not with the converter, but with GIF format itself:
http://en.wikipedia.org/wiki/Graphics_Interchange_Format
The format supports up to 8 bits per pixel thus allowing a single image to reference a palette of up to 256 distinct colors.
If you need the GIF to blend better with the background, click on Settings button in apng2gif and then choose the background color you want.

Resources