Converting png to jpeg increases image size - imagemagick

When I convert png to jpeg , size of image is increasing for 2 percent cases. I am using convert command of imagemagick for this. Also able to handle alpha transparency factor by maintaing white background . But , I am not getting increase in size of image . It is very well known that pngs are lossless and jpegs are lossy , then what is the specific reason and what can be work around for it.
Please refer above mentioned example pic

Try decreasing JPEG quality setting. Jpeg uses Discreet Cosine Transform (DCT) to decrease the size of spatial data, but on high quality setting with high-detailed input images
you will get some size increase due to the fact, that data is not quantized enough and DCT-ed data needs some storage too.

Related

Is there a video format where the coloured video is three times the size of its grayscale version?

Is there a video format in which the colored video is three times the size of its grayscale version. Say the grayscale video is of 30MB, is there any video format where it's colored version is 90MB. Because ideally the colored image should be roughly three times the size of its grayscale version. As grayscale contains a single array whereas colored images are made of three arrays.
However when I convert a colored MP4 or AVI videos into their grayscale versions, there is very much of a reduction in memory size. I wanted a video format in which there is at least 50% or more reduction in data.
An uncompressed video stream will indeed have three time the size for color compared to greyscale.
However, video compression typically treats the color component (hue and saturation, chrominance, or whatever is used) and the intensity (luminosity, brightness, or whatever is used) differently. The color component is typically compressed much more strongly, because our eyes are less sensitive to degradation in the quality of the color reproduction.
For example, JPEG compression (it's for photos, not video, but the same applies there) typically has 1/2 or 1/4 the number of samples for chrominance than for brightness. See the description of this on Wikipedia for more details.
Thus, it is normal and expected that there is not a 1:3 ratio in the size of compressed video stream for greyscale vs RGB video.

PNG Compression Not Reducing the size of images

I have certain png files. They are of size approx 1MB. I tried several command but they didn't work for me. Any suggestions. One is as below :
"C:\\Program Files\\ImageMagick-6.9.9-Q16\\mogrify.exe" -depth 8 -format png -define PNG:compression-strategy=2 -define PNG:compression-filter=0 test.png
Thanks,
As pointed out by #fmw42 in comments, your image may already be optimized. Also, #Mark's comment regarding reducing colors is true.
But apart from this, the important thing to know is that "there is no ideal command". You will have to figure out bit depth in your color channels and reduce them. There will always be a trade-off between reducing colors and quality you wish to pick.
Apart from that, there can also be other methods that you can use:
If opacity of PNG is fully opaque, you can strip alpha channel as it
makes no sense in that case. This can give you some file size savings.
If the image is visibly grayscale and still color type is
true-color, true-color-alpha or indexed-color, you can make significant savings by saving the image with a grayscale color space.
Retry optimizing PNG files using adaptive delta filtering and LZ77 Optimizations. This can be done easily using "optipng". But if the image is already optimized enough, this won't provide significant file sizes reduction. Moreover, choice of filtering depends upon png bit depths, so you would have to look up and understand PNG compression from various documentation available online regarding PNG compression.

Performance and Memory wise is JPG or PNG better for Core Image?

The title pretty much sums up the question but I was wondering if JPG/PNG files have a notable difference in speed and performance when using CIFilters. Is using one type of file preferred over the other? Is there another file type that could be potentially faster than both JPG and PNG?
JPEG and PNG are storage mechanism. Filters have to be performed on uncompressed data, not on JPEG or PNG streams.
The speed difference between JPEG and PNG occurs reading or writing. PNG compression generally is slower than JPEG compression. PNG expansion is generally faster than JPEG.
JPEG is not suitable for images that have abrupt changes in color, e.g. drawings, cartoons.
JPEG is not suitable for images that are stored, retrieved, modified, stored . . . . Each cycle changes the image.
JPEG generally produces much smaller compressed streams than PNG.
It actually depends! PNG's are better if it is a smaller image, as it cuts away the white surrounding what is actually there. But, it does not compress at all to maintain quality. This could slow down performance. JPEG compresses, therefore cutting down file size, but also compromising quality to a point. I'd say go for JPEG if it is a huge image for the app, but go for PNG if you want quality.
Thanks for asking and hope this helps. If this answers your question, I'd love if you could just hit that check mark.
Cheers,
Theo

Should I save an existing jpeg as a jpeg or as a png if I'm slightly altering it with a graphical overlay?

In particular, I'm using ImageMagick to draw a square over the jpeg, with a transparent fill and a pretty thin stroke?
My intuition says that the straight lines of the stroke might appear blurry, but that's less important than maintaining the quality and size of the original image.
Is there anything else that I should take into consideration?
Jpeg is lossy: compresses more but the quality decreases. You should try different levels of compression and comprare the results ( quality and size) against the png version. It may depend a lot on the contents of the image ( some images compress better than others)

GPUImage Large PNG Files

I can capture a still image on an iPad Retina Display with GPUImage using the crop filter (to 8x10 ratio with a size of 2420x1936 pixels = 4.68 megabytes) using capturePhotoAsPNGProcessedUpToFilter. The resulting PNG is 10mb, almost double the size of what an uncompressed image would be.
Is there a setting I am missing for PNG processing? Is there another way to reduce the size of the PNG file during capture?
A file this large really slows down things downstream.
Thanks for any advice or help!

Resources