Page 1 of 2

Maximum size convertion svg to png

Posted: 2014-06-21T02:41:20-07:00
by corematrixx
Dear!
I have a query about of which is the maximum size that can convert a svg to png.

because I have a function in php that converts svg to png but if you enlarge the web shows "internal error"

I leave the link for you to check: 
svg average size
http://vps-1150061-19745.manage.myhosti ... /svg/b.svg

convert function
http://vps-1150061-19745.manage.myhosti ... png2/b.svg

result
http://vps-1150061-19745.manage.myhosti ... igns/b.png

****
svg large
http://vps-1150061-19745.manage.myhosti ... /svg/a.svg

convert function
http://vps-1150061-19745.manage.myhosti ... png2/a.svg

result
http://vps-1150061-19745.manage.myhosti ... igns/a.png

I need your help to take several days looking for the error and why. be the liberia? or vps?

Greetings from Chile!
pd: thanks to google translate :P

Re: Maximum size convertion svg to png

Posted: 2014-06-21T10:05:30-07:00
by snibgo
The SVG links are broken.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T19:25:53-07:00
by corematrixx
snibgo, link are now repaired, thank you for commenting.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T19:50:05-07:00
by snibgo
The links:
http://vps-1150061-19745.manage.myhosti ... png2/b.svg
and
http://vps-1150061-19745.manage.myhosti ... png2/a.svg
are still broken.

Converting the other two SVGs, I get the same results as you. What is wrong with them?

Re: Maximum size convertion svg to png

Posted: 2014-06-21T20:44:33-07:00
by corematrixx
sure the error is given in the second link, which is why I need help I can not convert this file to png png, I think there is a limitation to the size.

http://vps-1150061-19745.manage.myhosti ... /svg/a.svg

link that says these are broken contain this function.

Code: Select all

    public function convert_png2($file_svg){
        error_reporting(E_ALL);
         ini_set('display_errors', 1);
        // $file_svg='80.svg';
        $file_name=explode('.',$file_svg);
        $svg1 = BASE_URL2.'images/designs/svg/'.$file_svg;
        $im = new Imagick();
        $im->setBackgroundColor(new ImagickPixel('transparent'));
        $svg = file_get_contents($svg1);
        
        $im->readImageBlob($svg);
        
        /*png settings*/
        $im->setImageFormat("png24");       
        $url='../images/designs/'.$file_name[0].'.png';
        $im->writeImage($url);
        $im->clear();
        $im->destroy();

        return BASE_URL2.'images/designs/'.$file_name[0].'.png';

    }
well I would like to know if anyone can turn this svg to png, try it by command line and says "killed".
http://vps-1150061-19745.manage.myhosti ... /svg/a.svg

Greetings!

Re: Maximum size convertion svg to png

Posted: 2014-06-21T20:57:47-07:00
by fmw42
It works fine for me and only takes a few seconds on IM 6.8.9.3 Q16 Mac OSX with RSVG 2.40.2 as my SVG delegate and libpng 1.6.10
See http://www.libpng.org/ for details about the PNG format.


convert -list format

PNG* PNG rw- Portable Network Graphics (libpng 1.6.10)

SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.2)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.40.2)

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:02:03-07:00
by snibgo
I can convert it with no problem. It is large: 7600x8460 pixels. Perhaps your server has set a limit.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:04:18-07:00
by corematrixx
fmw42 than good! apparently is the operating system for the error resulting in the console that says "killed" as an error message. I saw a post this
viewtopic.php?f=3&t=19643 , and so I understood a short service process CONVERTION, now I have to see how to configure Cent OS.

if anyone knows how I would appreciate, as I do not drive much in linux.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:07:12-07:00
by corematrixx
Snibgo, know how to set this limit?

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:07:34-07:00
by fmw42
Did you try the suggestion on that link

Code: Select all

convert -limit area 0 a.svg a.png
see http://www.imagemagick.org/script/comma ... .php#limit

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:22:50-07:00
by corematrixx
fmw42 worked perfectly! thank you very much! Now I'll see how to do it from php, I'm just starting to use imagick, and is seen to be a very powerful library.

Greetings from Chile, and thank you very much.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:42:56-07:00
by fmw42
Imagick does not have all the features of Imagemagick. I would suggest you use PHP exec() to run Imagemagick commands directly. I do not think that Imagick has an equivalent to -limit. But I do not use Imagick much and am not an expert with it.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:44:57-07:00
by fmw42
You may be able to speed up your processing by increasing the -limit area size. You should increase it in increments and find out how large it can be before it give you that error message again.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T21:46:59-07:00
by fmw42
This post does not appear to be suited to the Consulting forum, since that is for paid consulting. So I have moved this post to the Users forum.

Re: Maximum size convertion svg to png

Posted: 2014-06-21T22:25:53-07:00
by corematrixx
I knew it was not right payment inquiries here. whether it should be moved to users.
I managed to do anything from php with the following line of code.

Code: Select all

IMagick::setResourceLimit(IMagick::RESOURCETYPE_AREA, 0);
http://php.net/manual/en/imagick.setresourcelimit.php