SVG to TIFF conversion - Impact in Image resolution

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

ooh. ok. let me check and update you.
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

Hi,

I have loaded the solution now with the latest DLL's Magick.NET-AnyCPU and Magick.NET.Core which i downloaded in a ZIP file now.
after that when i try to initialise using var mgKimage = new MagickImage(); its showing an error message below.

Could not load file or assembly 'Magick.NET.Wrapper-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec' or one of its dependencies. The specified module could not be found.

When i added an additional DLL - Magick.NET.Wrapper-x86 along with other 2 the below error is coming.
Could not load file or assembly 'Magick.NET.Wrapper-x86.DLL' or one of its dependencies. The specified module could not be found.

--------------------------------------------

stack trace as below. can you please help.

[FileNotFoundException: Could not load file or assembly 'Magick.NET.Wrapper-x86.DLL' or one of its dependencies. The specified module could not be found.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'Magick.NET.Wrapper-x86.DLL' or one of its dependencies. The specified module could not be found.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'Magick.NET.Wrapper-x86.DLL' or one of its dependencies. The specified module could not be found.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9942412
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to TIFF conversion - Impact in Image resolution

Post by dlemstra »

You need a newer version of the C++ redistributable. But you probably want to wait a couple of days. I will publish a new release later this week/weekend that no longer has this requirement (https://magick.codeplex.com/discussions/650746)
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

dlemstra wrote:You need a newer version of the C++ redistributable. But you probably want to wait a couple of days. I will publish a new release later this week/weekend that no longer has this requirement (https://magick.codeplex.com/discussions/650746)
Thanks a lot. I have updated the C++ distributables and its working fine now. Also i have updated the solution with newer version of the Magick.net Thanks a lot for your support.
And a BIG thanks for creating this awesome Magick.Net :-)

Can I ask one more question please.
When i used a custom font in my SVG and while converting the same to TIFF or PDF, the fonts are getting resetted to the default one. Is there any way to retain the fonts used in SVG itself. I have created the SVG using AI / Inkscape.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to TIFF conversion - Impact in Image resolution

Post by dlemstra »

You should have the fonts installed on your system if you want librsvg (used to read SVG files) to be able to use them.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

dlemstra wrote:You should have the fonts installed on your system if you want librsvg (used to read SVG files) to be able to use them.
Ok. Thanks
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

Thank you guys.. it all worked fine :)

regarding fonts it worked perfect in my dev environment. but when i hosted the site in godaddy VPS server using plesk, the fonts are not getting detected. any idea how to solve this ?

thanks in advance - R
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to TIFF conversion - Impact in Image resolution

Post by dlemstra »

Did you install the fonts on your VPS?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

dlemstra wrote:Did you install the fonts on your VPS?

Hi .. yes i have installed the fonts. Is there any property that i need to change in my IIS to allow access to fonts folder ? or anything like that ?
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

ranjith328 wrote:
dlemstra wrote:Did you install the fonts on your VPS?

Hi .. yes i have installed the fonts. Is there any property that i need to change in my IIS to allow access to fonts folder ? or anything like that ?
Below are the steps that I did -

Installed all the fonts in the server
Then opened the SVG inside the server - all fonts are visible as expected.
Then hosted the website in IIS
Accessed the website outside Server. here ideally we should see the fonts with the defined one right ? but not showing up.
Next - we saved the SVG. the fonts are defaulted to some other fonts. and hence not working fine.

Is there any way i can make the fonts refer to the server than from the client side.
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

ranjith328 wrote:
ranjith328 wrote:
dlemstra wrote:Did you install the fonts on your VPS?
guys - any luck with it

I did few more steps. I removed the installed google fonts from the system. Now am not able to view the font style in the svg in the browser.

Next i added below to the aspx page.

<script src="https://ajax.googleapis.com/ajax/libs/w ... "></script>
<script>
WebFont.load({
google: {
families: ['Berkshire Swash', 'Fredoka One', 'Life Savers']
}
});
</script>

Now I'm able to view the fonts in the svg in the website.

But still when i tried to convert the svg to some other format, the fonts are not getting applied.

Requesting your help in this.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: SVG to TIFF conversion - Impact in Image resolution

Post by dlemstra »

I am not sure what you are trying to accomplish. Magick.NET is not a clientside library.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

dlemstra wrote:I am not sure what you are trying to accomplish. Magick.NET is not a clientside library.
Yes. Understood. Let me explain it clear. May be i have not conveyed my message very clear before. Please find the points below.

1. I have several SVG files in my server.
2. I have hosted a website through which users (clients) can access these SVG's.
3. In the website am giving facility for user to update the texts in the SVG. (all <text> tag in SVG are marked with ID field)
4. then am capturing the edited/new values in my function. Note. am just capturing the values and not the style tag.
5. Once user clicks save button. Am getting the new values, finding the <text> tag with specific id and then replace the text in it.
6. All these savings are happening in the server side. Only activity that will happen at client side is user will input value that need to be edited.
7. Now after saving, the new text is updated, but the style is not retained. and this is where am facing issue. :-(
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

extract of the code as below.

// this is where am find the texts that are updated.
foreach (var changeData in Results)
{
var txt = Svg.Root.XPathSelectElement(string.Format("./svg:g/svg:text[@id='{0}']/svg:tspan/svg:tspan", changeData.Id), xmlnsMan);
if (txt == null) Svg.Root.XPathSelectElement(string.Format("./svg:g/svg:text[@id='{0}']/svg:tspan", changeData.Id), xmlnsMan);
if (txt != null) txt.Value = changeData.Value;
}

// here am saving the updated SVG
using (var writer = XmlWriter.Create(outFilePath))
{
Svg.WriteTo(writer);
}

// here am converting this to PNG
MagickFormat outFormat = MagickFormat.Png;
var mgKimage = new MagickImage();
var mrs = new MagickReadSettings { Format = MagickFormat.Svg, ColorSpace = ColorSpace.Transparent };
mgKimage.Read(outFilePath, mrs);
mgKimage.Format = outFormat;
mgKimage.Write(file name is placed here);


Note:- Here the svg that are saved again with updated value is having the correct fonts , but not the png file
ranjith328
Posts: 28
Joined: 2016-02-01T04:44:13-07:00
Authentication code: 1151

Re: SVG to TIFF conversion - Impact in Image resolution

Post by ranjith328 »

any help will be really appreciated here ....
Post Reply