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. size of memorystream.toarray()

size of memorystream.toarray()

Scheduled Pinned Locked Moved C#
graphics
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.
  • J Offline
    J Offline
    JABIR E
    wrote on last edited by
    #1

    Bitmap BMP = new Bitmap(60, 32); Graphics g; g = Graphics.FromImage(BMP); g.DrawString("abcdef", font, Brushes.Red, new PointF()); MemoryStream mem = new MemoryStream(); BMP.Save(mem,ImageFormat.Bmp); Byte[] B = mem.ToArray(); size of B should be 60*32/8 but i got the size is 7734 can i get exact size pls

    G 1 Reply Last reply
    0
    • J JABIR E

      Bitmap BMP = new Bitmap(60, 32); Graphics g; g = Graphics.FromImage(BMP); g.DrawString("abcdef", font, Brushes.Red, new PointF()); MemoryStream mem = new MemoryStream(); BMP.Save(mem,ImageFormat.Bmp); Byte[] B = mem.ToArray(); size of B should be 60*32/8 but i got the size is 7734 can i get exact size pls

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      JABIR E wrote:

      size of B should be 60*32/8

      No, it shouldn't. It should be 54+60*4*32, which it is. Each pixel uses four bytes, not a single bit. The bmp file format is not a raw data file, it is an image file format that has a header (in this case 54 bytes), followed by the image data.

      --- single minded; short sighted; long gone;

      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