Png Image Saving the original size doubles
-
hi friends $ Seniors, i am trying to save an image in PNG format, the original image is 24dpi and is 16.2 mb, afterwards i add alpha channel to image and make some portion of the image transperant, after this when i save the image img.save(imagepath, imageformat.png) the size is increased to 33 mb. i wanted to know the image size increased is correct? does the image dpi changed from 24 to 32 increases the image so much? friends, also debugging my code i found a strange thing, which i would like to share with u Bitmap bmp = new Bitmap(imagepath); bmp.save("c:\11.jpg"); // this saved image with 16 mb Bitmap bmp1 = new Bitmap(bmp); bmp1.save(c:\\22.jpg); // this saved image with 33 mb Thanking in Advance Regards Samir
-
hi friends $ Seniors, i am trying to save an image in PNG format, the original image is 24dpi and is 16.2 mb, afterwards i add alpha channel to image and make some portion of the image transperant, after this when i save the image img.save(imagepath, imageformat.png) the size is increased to 33 mb. i wanted to know the image size increased is correct? does the image dpi changed from 24 to 32 increases the image so much? friends, also debugging my code i found a strange thing, which i would like to share with u Bitmap bmp = new Bitmap(imagepath); bmp.save("c:\11.jpg"); // this saved image with 16 mb Bitmap bmp1 = new Bitmap(bmp); bmp1.save(c:\\22.jpg); // this saved image with 33 mb Thanking in Advance Regards Samir
1. Maybe transparency uses the alpha channel, so now every pixel needs 4 bytes rather than 3? 2. you should never use Bitmap.Save(string), always use Bitmap.Save(string,ImageFormat). 3.
VCsamir wrote:
Bitmap bmp1 = new Bitmap(bmp);
An image may hold metadata, e.g. a camera creating a JPEG file adds a lot of metadata to the pixel data. Copying a bitmap like you do does not copy the metadata. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.