SVG to TIFF conversion - Impact in Image resolution
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
SVG to TIFF conversion - Impact in Image resolution
Hi There,
I am using Magick.Net to convert SVG files (Created using adobe illustrator) to Multipage TIFF. (i will be editing some text in svg using my solution)
Unfortunately eventhough i has created the SVG (vector) texts, after conversion to tiff files, the resolution is degraded and the quality is reduced.
Is there any way to keep the same resolution of vector after conversion.
Can you please help.
I am using Magick.Net to convert SVG files (Created using adobe illustrator) to Multipage TIFF. (i will be editing some text in svg using my solution)
Unfortunately eventhough i has created the SVG (vector) texts, after conversion to tiff files, the resolution is degraded and the quality is reduced.
Is there any way to keep the same resolution of vector after conversion.
Can you please help.
Re: SVG to TIFF conversion - Impact in Image resolution
In Magick++ I use :
To set the desired output of the SVG, You can probably find something similar in Magick.NET.
Code: Select all
image.resolutionUnits(Magick::PixelsPerInchResolution);
image.density(Magick::Geometry(dpi,dpi));
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
Hi.. i have already used similar steps in the code.
Re: SVG to TIFF conversion - Impact in Image resolution
And your ImageMagick version is built against librsvg?
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
hi - am using Magick.net-AnyCPU and not ImageMagick component
Re: SVG to TIFF conversion - Impact in Image resolution
Can you post the code you tried so far?
p.s. Magick.NET uses librsvg.
p.s. Magick.NET uses librsvg.
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
Hi.. below is the piece of code that i used to convert SVG to TIFF / PDF
I tried output format with both TIFF and PDF
/// <summary>
/// Convert SVG file to file of format specified
/// </summary>
/// <param name="svgFilePath">Path to input svg file</param>
/// <param name="outFormat">Output graphic format specification</param>
internal static MagickImage ConvertSvg(string svgFilePath, MagickFormat outFormat)
{
var mgKimage = new MagickImage();
var mrs = new MagickReadSettings
{
Format = MagickFormat.Svg,
ColorSpace = ColorSpace.Transparent,
Density = new MagickGeometry(ConfigHelper.ImageResolution)
};
mgKimage.Read(svgFilePath, mrs);
mgKimage.ResolutionUnits = Resolution.PixelsPerInch;
mgKimage.Format = outFormat;
mgKimage.BackgroundColor = new MagickColor(Color.Transparent);
return mgKimage;
}
I tried output format with both TIFF and PDF
/// <summary>
/// Convert SVG file to file of format specified
/// </summary>
/// <param name="svgFilePath">Path to input svg file</param>
/// <param name="outFormat">Output graphic format specification</param>
internal static MagickImage ConvertSvg(string svgFilePath, MagickFormat outFormat)
{
var mgKimage = new MagickImage();
var mrs = new MagickReadSettings
{
Format = MagickFormat.Svg,
ColorSpace = ColorSpace.Transparent,
Density = new MagickGeometry(ConfigHelper.ImageResolution)
};
mgKimage.Read(svgFilePath, mrs);
mgKimage.ResolutionUnits = Resolution.PixelsPerInch;
mgKimage.Format = outFormat;
mgKimage.BackgroundColor = new MagickColor(Color.Transparent);
return mgKimage;
}
Re: SVG to TIFF conversion - Impact in Image resolution
What is the value of ConfigHelper.ImageResolution?
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
<add key="imageResolution" value="450" />dlemstra wrote:What is the value of ConfigHelper.ImageResolution?
Re: SVG to TIFF conversion - Impact in Image resolution
Could you share an svg file that produces this odd behavior?
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
i am unable to attach the file. instead i have uploaded the file todlemstra wrote:Could you share an svg file that produces this odd behavior?
http://speedy.sh/pCmCe/kx1o5sdm.svg
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
Hi .. were you able to download the file ?
-
- Posts: 28
- Joined: 2016-02-01T04:44:13-07:00
- Authentication code: 1151
Re: SVG to TIFF conversion - Impact in Image resolution
also another point which we noticed is that, after conversion from SVG to tiff with dpi set as 450, the file size is growing to more that 120MB.ranjith328 wrote:Hi .. were you able to download the file ?
is that expected or an odd behavior ?
Re: SVG to TIFF conversion - Impact in Image resolution
From the command-line we get:
- convert -density 600 kx1o5sdm.svg -resize 25% -compress zip kx1o5sdm.tif
Re: SVG to TIFF conversion - Impact in Image resolution
And with the following code I get a 19MB file with Magick.NET that is perfectly readable:
Are you using the latest version of Magick.NET? It looks like you are using an older version. The most recent version uses a PointD for the density.
Code: Select all
using (var mgKimage = new MagickImage())
{
var mrs = new MagickReadSettings
{
Format = MagickFormat.Svg,
ColorSpace = ColorSpace.Transparent,
Density = new PointD(450)
};
mgKimage.Read(@"C:\kx1o5sdm.svg", mrs);
mgKimage.ResolutionUnits = Resolution.PixelsPerInch;
mgKimage.Format = MagickFormat.Tiff;
mgKimage.BackgroundColor = new MagickColor(Color.Transparent);
mgKimage.Write(@"C:\test.Tiff");
}