i am looking for a way to compress images with background transparency. I already know about UIImageJPEGRepresentation(FILE, CompressionLevel). With this snippet I reach my wished compressed file size (<100Kb (image quality is not that important)) but I lose my background transparency.
Does anyone of you guys know how to compress an image without losing its transparency?
if this helps in any way: I need to convert the image to data format anyways for certain actions and calculation.
Related
I am trying to create a background image on a webpage, which is similar to the 404 page used on tumbler...
http://testing404image.tumblr.com/
Here we can see a PNG which is 1623*1064 pixels, yet appears reasonably smooth gradient wise.
The direct link for the image is
http://testing404image.tumblr.com/images/status_bg.png?2
When I try to create a similar PNG (different colors, but same size) in Photoshop CS4 for Mac, the resulting file ends up at > 400k, whereas tumblers is 90k
Ive tried playing with all Photoshop options, including reducing number of colors to 55, but I cannot get the image below ~240k.
Ive also tried various optimising tools such as ImageOptim (http://imageoptim.com/) but to no avail.
Are there any properties of this PNG which result in a such a low file size?
I tried using JPG, thinking its better suited to gradient images, but even a 100% quality JPG resulted in noticeable aliasing, which an identical content/size PNG didnt have.
Thanks for any advice
Hi there changed the colours with
Image > Adjustments > Hue/Saturation - In Photoshop CS4
and this is the result:
as you can see it's almost the same size (75k).
Try playing around under the
Image > Adjustments
to get the color you are looking for and save as png with NONE for interlace.
Photoshop is not very good with PNG: I simply opened and saved it with the humble xnView (maximum compression), and got 74K. You can also convert it to paletted-image, and do some extra little tuning - PNGoptim gives me a final size of 64.548. I would't expect anything much better than that, the image is just too big.
BTW, be aware that using a gradient that is so big and so smooth that it a digital image (with 8 bits per pixel) cannot represent it without some banding. That image is really oversampled (you could resample it at 25% or less and display it scaled, and the result would be basically the same)
The actual reason is the source image your looking to have a lower gradient quality than the one you are making.
Just uncheck the Dither option (from the top toolbar in Photoshop) when filling the gradient color. the quality and smoothness of the gradient is decreased and therefore you get a very smaller file sized PNG output.
i am converting the image into thumbnail format and sending it to server and i want to convert it back to original size while receiving can any one please tell me how to resize the image to original without loosing quality.....
i tried directly to displaying the image in image view but the quality of the image is missing ...
can any one please help me how to maintain the quality of the image .......
Downscaling is irreversible, some information lost forever.
What you're asking isn't possible. You can't enlarge an image while maintaining the same quality. If you think about an image as a mapped array of pixels (literally, a "bit-map"), this makes sense. The image is saved with a fixed amount of data, and that's all you have to work with when you resize it. Any examples to the contrary (like TV shows) are purely fictional.
Investigate using vector graphics instead, which can be resized at will without a loss of quality.
you simply can not convert an image from thumbnail to original size and retain the quality it had in its original size.
if you want to display the image full-size, you have to send the full-size image.
You could think about using a Vector image? They do not lose quality when resized. But I have no clue whether you can use them for thumbnails in iOS.
See this wiki page for more info about Vector graphics.
I am working on images in iPhone. There are lots of jpeg images which range from 35kb to 50kb. I may need to transfer this over internet which comes around 6 mb. I tried to change a 35kb jpeg image to png. The actual size got increase jpeg was 56.1kb and png is 576 kb. I used mspaint to change the format. jpeg to png should actually decrease the size of the image right ? If no is that ideal to have jpeg files on iphone or only png like typical mobile applications have ?
JPEG and PNG are very different file formats; any given image that is smaller in one may not be smaller in another. And furthermore, their quality is not directly comparable.
For example, photographic content is very well represented in JPEG. The subdivision-of-blocks composed with pattern recognition makes for a format that does a very good job of discarding visual information in a way that human eyes do not easily notice. Of course, a highly-compressed JPEG may throw away too much information and show the blocks and instantly break the illusion of photographic reality, but used carefully, JPEG is fantastic for photos of the 'real world'.
And computer-generated content is very well represented in PNG. The lossless encoding is great for showing the straight lines of standard computer-generated displays, and naively-created gradients are replicated exactly with PNG. Had JPEG been used for either straight lines or naive gradients, the shortcomings would stand out instantly. Also, because PNG can be palette-based, it can very efficiently store images with only a few dozen colors.
So, pick the file format based on its use: JPEG for photos of reality or for very good approximations of reality, and PNG for computer-generated content.
PNG files are usually smaller if their contents are graphical and contain a lot of evenly colored shapes. For photos or scans jpeg files are way smaller, since they use a much more sophisticated, yet lossy, algorithm for compression.
For your iPhone project you should use whatever is smaller, in your case jpeg.
I am about to submit my first app to the iTunes App Store. The docs say that the application needs to be submitted with a "512x512 px, 72ppi, RGB, flattened, no transparency JPEG image".
I have a couple of questions:
RGB - what exactly does it mean in this context.
Flattened - does it mean that if I am creating the image in Photoshop, I should flatten all the layers? Doesn't saving to JPEG kind of imply that? Or does it mean something completely different.
No transparency - JPEG doesn't support it to begin with. What color should the background be then?
RGB means to ensure that you save the image as an RGB (rather than CMYK) JPEG. This is very likely to be the case already. (You can change the colour mode via the 'Image -> Mode' menu in Photoshop if you have the icon in the CMYK colour space for some reason. That said, all images destined for on screen usage should remain with the RGB colour space.)
As you say, directly saving as a JPEG (or doing save for web) will flatten the layers for you.
Whatever colo(u)r you want it to be. (i.e: It'll appear as saved.)
Hope that makes sense.
They're just being very verbose. Just send the jpeg(saved for web) and all those conditions will be satisfied.
If you made a transparent background it will render as white on a jpeg anyway.
don't worry. send it :)
I have an application that let's users view images. The user decides what images to use, so the size can range from 10x10 to 10000000x10000000 (I am exeggerating). All is well up to a certain size, when the image is bigger than the iPhone's memory. Quite understandably.
But how do I fix it? Is there a way to load only a portion of the image (I'm using an CATiledLayer, so I could load/release tile by tile).
Thanks in advance!
Unless you have an uncompressed image format it would be very hard to load the image in patches, you will have to provide the patches that the user would load, determine what portion of the image to show, and load the correct patches. There is an example for this "ScrollViewSuite" that demonstrate that technique. But this technique does require a preprocessing step.