Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Png Image Saving the original size doubles

Png Image Saving the original size doubles

Scheduled Pinned Locked Moved C#
graphicsquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VCsamir
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • V VCsamir

      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

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups