Tracing image to squares automatically?

Post questions on how to use or achieve an effect in Inkscape.
BackToMusic

Tracing image to squares automatically?

Postby BackToMusic » Tue Dec 07, 2010 8:37 pm

So i tried the automatic tracing of an image to vector graphics. However I want each pixel to become a square, the reason is that I'm going to distribute screen dumps in a file format to students and can't in that format disable automatic interpolation between pixels resulting in the print-outs being kind of blurry. However I can convert the image into "vector-pixels" then I have a solution that will work. Any tips?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Tracing image to squares automatically?

Postby brynn » Tue Dec 07, 2010 9:17 pm

....the reason is that I'm going to distribute screen dumps in a file format to students and can't in that format disable automatic interpolation between pixels resulting in the print-outs being kind of blurry.

This sounds like a raster format, correct? It sounds like you understand that raster graphics is pixel based, and that vector graphics is not?

However I can convert the image into "vector-pixels" then I have a solution that will work.

I don't think there's any such thing as "vector pixels", although I am certainly no expert.....

In vector graphics, pixels are really irrelevant, and there's no mapping of color to pixel. By definition, nothing is mapped to pixels, in vector graphics. At least that's my understanding. As far as know, you would have to convert each "screen dump" to vector, using either Inkscape's Trace Bitmap, or some other conversion tool.

BackToMusic

Re: Tracing image to squares automatically?

Postby BackToMusic » Tue Dec 07, 2010 10:49 pm

Oh the "vector-pixels" was just an analogy for: I want the conversion tool to make each sampled pixel from the bitmap a vector square filled with the same color as the sampled pixel. Thus in effect when scaling the resulting vectorbased image up, I would get the same result as when scaling an pixelbased image up without interpolation (well technically there would be interpolation even though it would be large pixels without (for example) linear interpolation between two color-values).

I could not achieve this with the trace bitmap function in Inkscape. With all options for smooth,simplify etc disabled it still cut corners and simplified the Image so detail was lost.

Slow Dog
Posts: 180
Joined: Wed Sep 24, 2008 7:51 pm

Re: Tracing image to squares automatically?

Postby Slow Dog » Tue Dec 07, 2010 11:06 pm

BackToMusic wrote:I want each pixel to become a square, the reason is that I'm going to distribute screen dumps in a file format to students and can't in that format disable automatic interpolation between pixels resulting in the print-outs being kind of blurry.


You want the pixels in some low-res image to display as squares in a bigger image? If so, I suggest you use a raster editor, and re-scale the image making sure it doesn't interpolate. In Paint.Net, "Resize" with resampling set to "Nearest Neighbour", or in GIMP "Scale Image" with interpolation "None".

Slow Dog
Posts: 180
Joined: Wed Sep 24, 2008 7:51 pm

Re: Tracing image to squares automatically?

Postby Slow Dog » Tue Dec 07, 2010 11:11 pm

/Addendum:

I see what you want. I've had the same issue; the ability to turn off smoothing doesn't really work.

What you can do is use "Tile Clones" of a pixel-sized square (you can scale it up after) with "Unset" colour over your bitmap, and get them the clones fill with the colour of the pixels beneath. It's a while since I've done it, and don't remember the details. Have a play while someone else comes along to help.

/Edit
Yep, that works.

Draw a pixel-sized square top-left of you imported bitmap. Set it stroke to none, fill to "Unset"
Edit->Clone->"Create Tiled Clones"
In the "Create Tiled Clones" dialogue, stick with "simple translation", and in the "Trace" tab set "Trace the drawing", "Pick from " "Color", and "Apply to..." "Color"
Set width and height as appropriate.

It takes a long time with anything but small images.
Last edited by Slow Dog on Tue Dec 07, 2010 11:32 pm, edited 2 times in total.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Tracing image to squares automatically?

Postby brynn » Tue Dec 07, 2010 11:12 pm

Well, if I'm wrong, someone else will surely reply with correct answer.
But as far as I know, what you're asking is impossible. Vector graphics ignores pixels. As far as vector graphics is concerned, there are no pixels.

If I understand what you're asking, I have thought about doing it as an experiment. I want to make a grid on a scale where each grid cell represents a pixel. Then take some small graphic in raster format, and zoom in to the point where I can see each pixel. Then I would take the color from each pixel, and fill each representative grid cell. Then each tiny cell would be vectored color, in effect, what you're describing vector-pixels.

But as far as I know, it only exists in my head. There is no tool to do this, to my knowledge.

EDIT -- Oh right, Slow Dog. This could be done with Tiled Clones! But still no automated tool to take a screen shot and automatically convert it to such, right?
(We posted simultaneously.)

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Tracing image to squares automatically?

Postby chriswww » Wed Dec 08, 2010 10:50 pm

maybe imagemagick utility will allow you to pixelate an upscaled image..also to do the scaling of bitmap image as well. vector format is diametrically opposed to pixelation and other bitmap/raster image problems, and hence you won't find tools in inkscape to easily let you re-produce pixelation. not saying it can't be done...but inkscape wouldn't be my first choice for doing that.

ivan louette
Posts: 215
Joined: Thu Aug 21, 2008 4:08 am
Location: Belgium

Re: Tracing image to squares automatically?

Postby ivan louette » Thu Dec 09, 2010 3:09 am

Slow Dog wrote:/Addendum:

I see what you want. I've had the same issue; the ability to turn off smoothing doesn't really work.

What you can do is use "Tile Clones" of a pixel-sized square (you can scale it up after) with "Unset" colour over your bitmap, and get them the clones fill with the colour of the pixels beneath. It's a while since I've done it, and don't remember the details. Have a play while someone else comes along to help.

/Edit
Yep, that works.

Draw a pixel-sized square top-left of you imported bitmap. Set it stroke to none, fill to "Unset"
Edit->Clone->"Create Tiled Clones"
In the "Create Tiled Clones" dialogue, stick with "simple translation", and in the "Trace" tab set "Trace the drawing", "Pick from " "Color", and "Apply to..." "Color"
Set width and height as appropriate.

It takes a long time with anything but small images.


That was exactly the way Corel Trace did it optionally a long time ago.

Flash tracer function did it also very nicely too already a long time ago. The difference with Corel trace was that in Flash the pixel groups of a same color created an unique shape while in Corel each pixel keeps its own quadrangle.

A very interesting feature to introduce in Inkscape tracer like creating stroked lines also is !

ivan


Return to “Help with using Inkscape”