Mobile app version of vmapp.org
Login or Join
Sent7350415

: Using inkscape to convert scanned color drawings to svg -- recommended or no? I'm an ebook publisher trying to include 10 color illustrations inside an ebook. It's not a fixed layout ebook

@Sent7350415

Posted in: #Ebook #Inkscape #Raster #Resize #Svg

I'm an ebook publisher trying to include 10 color illustrations inside an ebook. It's not a fixed layout ebook but a reflowable ebook (i.e., an epub).

Graphic example here: www.flickr.com/photos/rjnagle/sets/72157641718117054/ (Sort of low resolution -- but this should give you an idea about what they look like -- the text refers to the story title).

I'm working with a talented artist who is good at drawing but doesn't really know much or anything about graphic formats. She has limited experience using graphics software. Ironically although I have absolutely no artistic talent, I'm more comfortable than she is about using graphics software -- especially to do a specific task. I'm pretty good at using gimp.

She has given me some images in high quality jpg formats. Possibly she could rescan the images -- although I already have 300 dpi of everything. Ideally I'd like these interior images to scale on the fly and to separate the text information from the graphic itself. The software on the major tablets are starting to support svg images, and one of the problems with these 10 images is that they incorporate text and images together (They are chapter headings). I need an image which will adjust well to low resolution and high resolution devices.

I see that inkscape has tools for turning raster images into vectors (using trace bitmap for example). My aim is to create faithful images (perhaps cropping out the text and overlaying text in Inkscape). My questions:


Can Inkscape do this adequately well?
How complex a task would this be for someone who is good at software but not necessarily an artist?
Do you have any general suggestions about doing this or have any URL's to recommend. (My main goal is fidelity to the original image).


Some more characteristics of the original artwork:

Lots of whitespace. The image rectangle will occupy about a third of the tablet page. About 2/3 of the drawing is curvy line drawings using a black pen. However, in the center there's a half-circle containing a color sketch with a filled color background that sometimes is fairly intricate and has impressionistic brush strokes. This color sketch is trying to depict a scene
from the book.

I'm trying to figure out whether it's worth the effort to convert the image to vector, or whether I should just leave it as a jpg and remove the text from it (which is fairly easy to do because it's underneath the image itself and completely separate from it). Leaving them as JPGs is easier and the ebook software all supports that, but it doesn't future-proof or scale images well --you usually have to specify a specific image dimension.

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent7350415

4 Comments

Sorted by latest first Latest Oldest Best

 

@YK2262411

Your best approach for filesize, image quality, and flexibility will probably be a SVG with an embedded image (or two). If you size and position everything (text, image, vector graphical elements) with the SVG and then put an appropriate "viewBox" parameter on it, the SVG format will handle scaling down the images to size.

If you are able to successfully (from a graphical and file-size) convert the line-drawing border to an SVG path using @boblet 's technique that might be worthwhile, but I suspect you'll find that @Takkat assessment of filesize versus quality will hold true for the coloured images.

Also, the border drawings for the two images are almost the same. If you and the artist are okay making them exactly the same, then you could re-use that content in each SVG, regardless of whether you decide to go with a vector or raster format for it. And even if you do go with a raster format, it doesn't have to be the same format as for the coloured sections -- you could use full-colour JPEG for the insets and monochrome PNG with transparent background for the border.

Your svg code would look something like this:

<svg id="ch1-title-image" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMin meet">
<defs>
<desc>
Chapter 1
<!-- add some extra info for screen readers, since they won't
know that the <text> below is styled like an <h2> heading -->
</desc>
<clipPath id="inset-ch1">
<path d="<!-- define border of coloured area here -->"/>
</clipPath>
<defs>

<image xlink:href="images/Ch1.jpeg"
x="350" y="100" width="300" height="200"
clip-path = "url(#inset-ch1)" />
<!-- position and size the coloured image within the SVG,
and crop it to shape, the image file will be scaled to fit
this rectangle -->

<image xlink:href="images/ChapterBorder.png"
x="0" y="0" width="1000" height="500" />
<!-- an <image> element also works if the border is saved as an SVG, but
you could also use a <use> element (which would allow you to set CSS styles
on the main file and have it inherited by the embedded file) -->

<text x="500" y="400" text-anchor="middle" font-size="60">
The Lamp in the Window
</text>
</svg>


For the other chapters you would change the url in the first <image>, the text content and the id values. Unfortunately you have to repeat the clipping path each time (unless you're sure that this is always going to be one long HTML file) because clip-path references always have to be to a fragment within the same file, although you could use a <use> element within to reference the path itself. It's probably not worth an extra file request on its own, but it would be optimal if you define the border as an SVG file, then you could have a path within it (even if invisible) that defines the border for the coloured area:

<svg id="ch1-title-image" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMin meet">
<defs>
<desc>
Chapter 1
</desc>
<clipPath id="inset-ch1">
<use xlink:href="images/ChapterBorder.svg#inset-border"/>
</clipPath>
<defs>

<image xlink:href="images/Ch1.jpeg"
x="350" y="100" width="300" height="200"
clip-path = "url(#inset-ch1)" />

<use xlink:href="images/ChapterBorder.svg"
x="0" y="0" width="1000" height="500" />

<text x="500" y="400" text-anchor="middle" font-size="60">
The Lamp in the Window
</text>
</svg>


"inset-border" would have to be the id of a <path> or <g> element within "ChapterBorder.svg".

Size the SVG using CSS, being sure to set height:auto;. The text and images will scale perfectly. See this StackOverflow Q&A for more on getting SVG images to size responsively.

10% popularity Vote Up Vote Down


 

@Harper654

Using inkscape to convert scanned color drawings to svg — recommended
or no?


I would say, generally tracing photos or detailed, photo-like images is very very difficult to do well, so not really. But of course, there are ways...

Based on the image you provided, here is what I would attempt:

The black and white line-drawings should be simple enough to trace. I would ask to get scans of the coloured parts in as high a resolution as possible.

I would trace the black and white and the coloured parts separately. To do them together would bring too many elements and compromises.

Please note that these examples are Illustrator, and I am no expert in Inkscape. However; Inkscape should have about the same abilites.

Here is part of the image you provided:



First, I would take the whole thing into photoshop/gimp and go mad on contrast. The aim here is the black and white, ignore the colour for now. Alternatively, you could get her to scan the whole thing as high contrast black and white.

So they are pretty equal. To be clear: untraced on the left, traced on the right:


The colours are all over the place and not like the original. I would then trace the same image again, from the original, but this time only considering the coloured parts.

In the end you should have two layers, where one is optimised the black-white, and one with the optimised coloured part.

I would remove the text from the drawing, add that in Inkscape in a third layer as text.

The exact steps in Inkscape, alas, I cannot tell you; but the trace function should have alternatives for high fidelity. You will probably have to fiddle around with it, but it get much easier when you only have to focus on one element at a time (i.e. coloured vs. black-and-white).

10% popularity Vote Up Vote Down


 

@Shelley591

Can Inkscape do this adequately well?


Yes, though it depends on the type of art, of course.


How complex a task would this be for someone who is good at software but not necessarily an artist?


The auto-trace tool is pretty much just setting variables and clicking the button. So, not complex, but may require a bit of trial and error.


Do you have any general suggestions about doing this or have any URL's to recommend. (My main goal is fidelity to the original image).


Use your eyes. Set up the autotrace to use fewer colors, fewer points and see how it looks. If it's not to your standard, do it again with slightly more colors and points. Repeat until it looks good to you.

At that point, you need to then compare the file size of the SVG vs. a comparable JPG.

The one main advantage of SVGs on tablets is that they are vector based, they aren't beholden to a particular screen resolution. So, remember to compare a JPG at a retina-screen quality with the SVG to make it a fair comparison.

UPDATE:

I just saw that you posted sample images. I'd say there's two styles going on here. One is line art (the border, decorative frame, etc.) and then there's the continuos tone illustrations within.

The former is ideal for auto-tracing. The latter will be tricky.

In an ideal world/hindsight, I would suggest that you have the internal illustration also created as line art. Any color could then be added after the fact in large swaths behind the line art.

10% popularity Vote Up Vote Down


 

@BetL875

The advantages in using a traced SVG file over a compressed bitmap image in JPEG format depend much on the complexity of content.

Simple objects

In case we have few colors, and simple geometrical objects a traced vector image will gain clarity is scalable without losing much information, and will be smaller in size than the bitmap:


Left 7.2 kB JPG source. Right 4.9 kB traced SVG

Drawings or photos

Now this will be different for hand drawings. Below example shows what can be done with basic settings in Inkscape's trace tool:


Bitmap Source: Wikimedia Max & Moritz

We can see that the traced image is better the more scan objects we create. But alas the file size of the SVG having 64 non-smoothed scans grew to huge 11.1 MB. This is way out making sense considering the bitmap JPG had only 141.9 kB of size.

Still the quite loss 6-scan smoothed SVG will have double the size of the bitmap JPG.

Only if we further reduce the complexity we may get a smaller file size than the JPG had. But this may not really meet our needs:


Left 102 kB simplified trace with 5 scans. Right 142 kB JPG compressed bitmap.



Combining traced vector and embedded bitmap

Whenever we have source images which consist of a combination of line draw and coloured drawings as it is in your example given we may want o separate these parts.


Remove the coloured image parts and reduce the line drawings to a black/white only bitmap (here done with Gimp free selection, then Colors > Threshold).


Save the coloured image part as a separate bitmap:


Trace the black & white border with Inkscape (Path > Trace Bitmap > 2 scans Grays, no optimization)


Above traced vector, below bitmap source
Embed the bitmap we saved in 2. in the vector image:



We can see now that on scaling the SVG we will also scale the bitmap resulting in block artifacts on the bitmap part only:




Resulting file sizes from steps above where as follows:

Source bitmap image PNG: 567.1 kB
Source bitmap image JPG: 89.2 kB (80% compression)
Vectorized Frame SVG: 176.6 kB
SVG with embedded PNG: 441.5 kB


The procedures as shown above can be done in Inkscape with more or less default settings, requiring not much of knowledge in graphics processing. The tricky parts are getting the threshold on reducing colors right to not remove too much of the drawing, and to decide how much simplification we need on the resulting traced vector image.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme