Skip to content

Conversation

@zizon
Copy link

@zizon zizon commented Sep 14, 2015

for some image format like SVG which may contains no size info.
without the size hint,convert to other format will fail.

this patch try to resolve this issue.

for some image format like SVG which may contains no size info.
without the size hint,convert to other format will fail.

this patch try to resolve this issue.
@zizon zizon closed this May 11, 2016
@elad
Copy link
Owner

elad commented May 11, 2016

Why did you close it? I'm sorry I didn't get to it, but nobody has commented on it. Is it working? Could you please provide updates to the readme file and examples too?

@zizon
Copy link
Author

zizon commented May 12, 2016

@elad
I apologize for this PR,since it is not a real case for node-imagemagick-native.

here is a sample I encountered.

'use strict';
var fs = require('fs');
var imagemagick = require('imagemagick-native');

fs.writeFileSync('after.png', 
        imagemagick.convert({
            srcData: new Buffer('<svg style="width: 65.7px; height: 23.4px; background: transparent;"><path style="border: 0px; fill: rgb(230, 124, 115);" d="M 0 0 L 0 0 L 65.7 0 L 65.7 23.4 L 0 23.4 Z" transform="translate(0 0)"></path></svg>'),
                format: 'PNG',
                srcFormat : 'SVG',
            },
            function(err,buffer){
                if(err){
                    console.error(err.stack);
                }
                console.error(buffer);
            }
        )
);

this will made ImageMagick cry with something like

libc++abi.dylib: terminating with uncaught exception of type Magick::ErrorOption: Magick: must specify image size `/var/tmp/magick-51726APWSamKmP4Oy' @ error/mvg.c/ReadMVGImage/185

this is cause by this.

recall sample SVG above,it has no viewbox attributes for its svg element.
ImageMagick could not infer size informations from this malformed blueprint(although for some browsers, it works because of the style?).

so basically speaking,it is a misuse.

my fault.
again, sorry to bother you.

lastly, as a minor suggestion,
it would be nice if to catch an additional exception type MagickCore::ExceptionInfo here, to help clarify the boundary,and knowing what went wrong inside ImageMagick.

@elad
Copy link
Owner

elad commented May 13, 2016

It's okay, no bother at all! All PRs are welcome, even those that turn out to not be necessary...

lastly, as a minor suggestion,
it would be nice if to catch an additional exception type MagickCore::ExceptionInfo here, to help clarify the boundary,and knowing what went wrong inside ImageMagick.

Sounds like a necessary PR, how about you file one? ;)

@zizon
Copy link
Author

zizon commented May 16, 2016

fire a new PR.
see #126

as simple as adding another compiler flag to enable/force RTTI generation.

On Sat, May 14, 2016 at 5:27 AM, Elad Efrat [email protected]
wrote:

It's okay, no bother at all! All PRs are welcome, even those that turn out
to not be necessary...

lastly, as a minor suggestion,
it would be nice if to catch an additional exception type
MagickCore::ExceptionInfo here, to help clarify the boundary,and knowing
what went wrong inside ImageMagick.

Sounds like a necessary PR, how about you file one? ;)


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#103 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants