Re: Bitmap -> GIF/PNG/JPG



Michael Mahemoff wrote:
Hi,

Can anyone please recommend a package for generating images from a
bitmap vector. e.g. If I have an list of integers, each representing a
colour on the bitmap, and I want to build a GIF from it (along with some
other meta-info like dimensions).

The main options seem to be RMagick and RCairo, but neither seems to
take a bitmap input. I'd have to create a blank canvas and draw each
pixel. Do-able but inefficient.

Check out Magick::Image#import_pixels:
http://www.simplesystems.org/RMagick/doc/image2.html#import_pixels. If
the input pixels are in a string buffer this is an extremely fast
method. If the pixel data are in an array it's still faster than drawing
each pixel separately.

If your pixel data are in a file you may be able to simply describe it
as being in "RGB" or "RGBA" format, in which case RMagick can convert it
for you. See http://www.imagemagick.org/script/formats.php.

--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • =?iso-8859-1?Q?Re:_CopyFromScreen_Bitmap_als_Bild_speichern_und_Gr=F6=DFe?= =?iso-8859&#
    ... wenn du mit der Auflösung festlegst, dass in einem Zoll 96 Pixel darzustellen sind, dann belegen 200 Pixel etwa 55 mm. ... Dim bmp As Bitmap = New Bitmap ... g.DrawImage(bmp, 0, 0, breite, hoehe) ... Wie Du erkennen kannst ist die Linke Grafik nur noch halb so breit wie die Obere, ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: count colors in bitmap
    ... But on my own two machines your code DOES crash on a 1024 x 768 bitmap! ... And it also DOES crashes on a 3200 x 2400 pixel bitmap. ... Why don't you just believe me, and check things out further yourself, perhaps on the machines of other people you might know, specifically on machines that might be differently configured and running different vesions of the OS than your own. ... Private Declare Function LoadImage Lib "user32" Alias _ ...
    (microsoft.public.vb.general.discussion)
  • Re: count colors in bitmap
    ... But on my own two machines your code DOES crash on a 1024 x 768 bitmap! ... And it also DOES crashes on a 3200 x 2400 pixel bitmap. ... on both of my own machines your app CRASHES on both a 1024 x 768 bitmap and on a 3200 x 2400 pixel bitmap. ... Private Declare Function LoadImage Lib "user32" Alias _ ...
    (microsoft.public.vb.general.discussion)
  • Re: count colors in bitmap
    ... But on my own two machines your code DOES crash on a 1024 x 768 bitmap! ... And it also DOES crashes on a 3200 x 2400 pixel bitmap. ... Private Declare Function LoadImage Lib "user32" Alias _ ...
    (microsoft.public.vb.general.discussion)
  • Re: Converting a GDI+ 24-bit RGB Bitmap to an Indexed Format Bitmap
    ... I created and populated a new palette and an array of indexed pixel ... method to create the new GDI+ "indexed" Bitmap. ... Is a stride necessary with indexed pixel data? ...
    (microsoft.public.win32.programmer.gdi)