piqnt / svgexport

SVG to PNG/JPEG command-line tool and Node.js module
927 stars 85 forks source link

Export issue when missing width/height #21

Closed theogravity closed 9 years ago

theogravity commented 9 years ago

Do you have ideas on what settings to use to get this to rasterize properly? I've tried various combinations of settings (using pad vs crop, scale values, etc). The raster comes out extremely cut off.

(facebook icon)

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <rect fill="#3B5998" width="100" height="100" rx="8"/>
  <rect fill="#6d84b4" width="90" height="15" x="5" y="80" rx="5"/>
  <path fill="#FFF" d="M76,94h-18v-42h-8v-15h8v-8c0-12,5-19,19-19h12v14h-7c-6,0-6,2-6,6v7h13l-2,15h-11v42z"/>
</svg>

I know it works if I manually add in a width and height, but I have a bunch of files that are like this and want to avoid a manual edit:

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
  <rect fill="#3B5998" width="100" height="100" rx="8"/>
  <rect fill="#6d84b4" width="90" height="15" x="5" y="80" rx="5"/>
  <path fill="#FFF" d="M76,94h-18v-42h-8v-15h8v-8c0-12,5-19,19-19h12v14h-7c-6,0-6,2-6,6v7h13l-2,15h-11v42z"/>
</svg>
shakiba commented 9 years ago

This is the same as #19 which is still open. I just tried again to find what causes this issue and fortunately found it this time, now I will work on fixing it. I'm going to close this issue, please follow #19.

theogravity commented 9 years ago

Wow thanks for the rapid response!

shakiba commented 9 years ago

@theogravity It is fixed, finally! Please try it and let me if it works for you.