Thanks for the reply. I still don't get it.
The sample posted did not have all of the issues. Sorry. The real svg has other colors used to create "grey" regions. The printer is a Zebra B&W bar code printer and it does no processing of the image. It is either black or white.
Since I posted, I found a SVG option that sharpened the lines. The sample below has that change.
I'm still confused as to how density of 135 produces a 405 pixel png with a 3 x 3 reported size in the png.
Desired pixels in png = 203 dpi * 2" image size = 406. I can deal with being 1 off.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" width="144pt" height="144pt" viewBox="0 0 143 143"
version="1.1"
shape-rendering="crispEdges"
>
<g transform="translate(10,10)">
<rect x='0.00' y='0.00' width='20.00' height='20.00' style='fill:orange' />
</g>
<g transform="translate(36,36)">
<rect x='0.00' y='0.00' width='72.00' height='72.00' style='fill:black' />
</g>
</svg>
Here are the commands
Code: Select all
\ImageMagick-6.8.8-7\convert -density 135 testsvg.svg -monochrome testsvg.png
\ImageMagick-6.8.8-7\identify -verbose testsvg.png
Here is the output:
Code: Select all
snip \ImageMagick-6.8.8-7\convert -density 135 testsvg.svg -monochrome testsvg.png
convert.exe: `%s' (%d) "inkscape" "testsvg.svg" --export-png="C:/Users/JAREDD~1/
AppData/Local/Temp/magick-5424gy1xlBeRPGaC" --export-dpi="135,135" --export-back
ground="rgb(100,100,100)" --export-background-opacity="1" > "C:/Users/JAREDD~1/A
ppData/Local/Temp/magick-5424Bk5yTHwMxD_v" 2>&1 @ error/utility.c/SystemCommand/
2036.
Code: Select all
snip ImageMagick-6.8.8-7\identify -verbose testsvg.png
Image: testsvg.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: PseudoClass
Geometry: 405x405+0+0
Resolution: 135x135
Print size: 3x3
Units: Undefined
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 8/1-bit
Channel depth:
gray: 1-bit
snip
Properties:
date:create: 2015-07-03T14:49:50-04:00
date:modify: 2015-07-04T09:28:15-04:00
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45455 (See Gamma, above)
png:IHDR.bit-depth-orig: 1
png:IHDR.bit_depth: 1
png:IHDR.color-type-orig: 0
png:IHDR.color_type: 0 (Grayscale)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 405, 405
png:pHYs: x_res=135, y_res=135, units=0
png:text: 3 tEXt/zTXt/iTXt chunks were found
signature: d6e7f5241d439e2719649b526e3815610677561f41000546dd715328120245a3
svg:base-uri: file:/// snip /test
svg.svg
Artifacts:
filename: testsvg.png
verbose: true
Tainted: True
Filesize: 948B
Number pixels: 164K
Pixels per second: 10.25MB
User time: 0.016u
Elapsed time: 0:01.016
Version: ImageMagick 6.8.8-7 Q16 x86 2014-02-13 http://www.imagemagick.org
I then tried this:
Code: Select all
convert -density 406 testsvg.svg -resize 50%% -monochrome testsvg1.png
density = desired dpi * 2 ( x 4 took too long to execute)
resize = 1/2 = 50%
But it produced a png with 1832 pixels vs the desired 406 pixels. The black rectangle no longer has crisp edges.
Code: Select all
mage: testsvg1.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: PseudoClass
Geometry: 1832x1832+0+0
Resolution: 406x406
Print size: 4.51232x4.51232
Units: Undefined
This produces a 915 pixel png
Code: Select all
convert -density 203 -size '144x144' testsvg.svg -resize '406x406' -monochrome testsvg3.png
Thanks again for your help.