Convert pixels to rectangles in a vector format

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lynx_abraxas

Convert pixels to rectangles in a vector format

Post by lynx_abraxas »

Hello!


I'm looking for a tool that can convert a simple bitmap (of small size) to a vector graphic (eg svg) by simply creating a filled square for each pixel. Can this be done with IM or another tool? I'd need this to visualize in "high zoom" the selected pixel with a thin path and how some filter changes these.

Thanks for any help or hint on this.
Lynx
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert pixels to rectangles in a vector format

Post by fmw42 »

i am not an expert on this, but IM can convert digital images into svg format using the RSVG delegate library.

see
http://www.imagemagick.org/Usage/draw/
http://www.w3.org/TR/SVG/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Convert pixels to rectangles in a vector format

Post by magick »

The RSVG delegate library is required to read an SVG file. Recent versions of ImageMagick can write SVG images like this:
  • convert image.jpg image.svg
lynx_abraxas

Re: Convert pixels to rectangles in a vector format

Post by lynx_abraxas »

Thanks for the answers but I'm looking for a conversion without a fancy path tracing. In contrast to most cases I want to keep the pixly appearance of a very low resolution bitmap.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert pixels to rectangles in a vector format

Post by fmw42 »

why not just zoom the image using -scale, which will pixel replicate without interpolating.

convert smallimage -scale 1000% largeimage

this will scale by a factor of 10.
lynx_abraxas

Re: Convert pixels to rectangles in a vector format

Post by lynx_abraxas »

The images are ment to go into latex and at the moment I don't know what final zoom will be needed. Also this bloats the imige up a lot since I need around 10x the original size.
Post Reply