I’m using ImageMagickObject COM+ in Classic ASP. I am trying to convert an SVG-file to a PNG one. I tried the example seen here:
convert rose.jpg rose.png
This works fine when performed in the command-line. This example also works when executed using classic ASP. So, everything seems to work. I then try the same command via ASP, only using an SVG-file instead of JPG as the source file like so:
convert rose.svg rose.png
This does not work. I get no error, but still no PNG-file.
So I then tried this command in the command-line, and it works. I have tried different SVG-files and they all fail to convert using ASP, but all work via the command-line.
The component therefore seems to be installed, and I can convert and write to file from ASP, so I’m guessing the permissions are fine as well.
What could be the issue here?
Thanks
EDIT:
I modified the example posted below. This code currently works:
Dim sourceFile : sourceFile = server.mappath("/tempbild/rose.jpg")
Dim destFile : destFile = server.mappath("/tempbild/test.png")
Dim img: Set img = CreateObject("ImageMagickObject.MagickImage.1")
Dim DrawResult
DrawResult = img.Convert(sourceFile, destFile)
If Err.Number <> 0 Then
Response.Write("ImageMagick component failed: " & Err.Number & ": " &
Err.Description)
else
response.write("ImageMagick component tested successfully: " & DrawResult)
end if
Set img = nothing
When I change the file type to SVG in either sourceFile or destFile, then it stops working. I do not get an error message and no DrawResult.
Ok, I finally managed to find the answer here. It seems the IIS does not use the TEMP directory when converting between jpg and png, which is why it works. However, when converting to or from svg, the TEMP directory is written to. On the TEMP directory of the server (c:\windows\temp in my case) you need at least to give “change” rights to IUSR user, I added “write” rights.