1

I want to use ImageMagick convert command but using a base64 image:

convert img1.jpeg -distort barrel 'a b c' img2.jpeg

But I do not really know how to do this, because in ImageMagick documentation they suggest to use inline but I am obtaining segmentation fault after:

convert inline:base64.txt -distort barrel '-0.03 -0.0 -0.3' output
fmw42
  • 46,825
  • 10
  • 62
  • 80
m33n
  • 1,622
  • 15
  • 38
  • This should help... https://stackoverflow.com/a/32702293/2836621 – Mark Setchell Nov 14 '17 at 19:53
  • Possible duplicate of [How do I convert a base64 image?](https://stackoverflow.com/questions/32698451/how-do-i-convert-a-base64-image) – OznOg Nov 14 '17 at 20:00
  • I have seen that question before, but that not working for me since I am getting a segmentation fault – m33n Nov 14 '17 at 20:22
  • I did not have any success with Imagemagick, php and base64 except on very small files and gave up. I found it did work with GD but changed direction. – Bonzo Nov 14 '17 at 20:42
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Nov 14 '17 at 20:59
  • The question is about a segmentation fault from ImageMagick. I believe this is appropriate to ask, but if others agree with @JWW, then the OP could post to the ImageMagick forum at http://www.imagemagick.org/discourse-server/. However, I would provide the same answer as below on that forum. I think this is likely an imagemagick version issue and have shown below that it works fine with current versions of ImageMagick. – fmw42 Nov 14 '17 at 23:06

1 Answers1

2

This seems to work for me in ImageMagick 6.9.9.23 Q16 Mac OSX:

input:

enter image description here

convert noseguy.gif inline:b64_noseguy.txt

cat b64_noseguy.txt

data:image/gif;base64,R0lGODlhIAAgAPIEAAAAAB6Q/76+vvXes////wAAAAAAAAAAACH5BAEAAAUALAAAAAAgACAAAAOBWLrc/jDKCYG1NBcwegeaxHkeGD4j+Z1OWl4Yu6mAYAu1ebpwL/OEYCDA0YWAQuJqRwsSeEyaRTUwTlxUqjUymmZpmeI3u62Mv+XWmUzBrpeit7YtB1/rpTAefv942UcXVX9+MjNVfheGCl18i4ddjwwpPjEslFKDUWeRGj2fnw0JADs=

convert 'inline:data:image/gif;base64,R0lGODlhIAAgAPIEAAAAAB6Q/76+vvXes////wAAAAAAAAAAACH5BAEAAAUALAAAAAAgACAAAAOBWLrc/jDKCYG1NBcwegeaxHkeGD4j+Z1OWl4Yu6mAYAu1ebpwL/OEYCDA0YWAQuJqRwsSeEyaRTUwTlxUqjUymmZpmeI3u62Mv+XWmUzBrpeit7YtB1/rpTAefv942UcXVX9+MjNVfheGCl18i4ddjwwpPjEslFKDUWeRGj2fnw0JADs=' b64_nose_guy.png


enter image description here

If your ImageMagick version was older than Feb 10, 2015 (about IM 6.9.0.5) then there was a 4096 character limit to inline due to a bug. See http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=26918&p=119520&hilit=inline+base64#p119520

Furthermore, this command to do barrel distortion also works fine:

convert 'inline:data:image/gif;base64,R0lGODlhIAAgAPIEAAAAAB6Q/76+vvXes////wAAAAAAAAAAACH5BAEAAAUALAAAAAAgACAAAAOBWLrc/jDKCYG1NBcwegeaxHkeGD4j+Z1OWl4Yu6mAYAu1ebpwL/OEYCDA0YWAQuJqRwsSeEyaRTUwTlxUqjUymmZpmeI3u62Mv+XWmUzBrpeit7YtB1/rpTAefv942UcXVX9+MjNVfheGCl18i4ddjwwpPjEslFKDUWeRGj2fnw0JADs=' -distort barrel '-0.03 -0.0 -0.3' b64_nose_guy_barrel.png


enter image description here

The barrel result is just a little bit narrower in width than the non-barrel result.

If it does not work for you, perhaps you need to upgrade your version of ImageMagick. You did not say what version and platform you were using

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • Would the person who marked my answer down, please let me know why? Have I misunderstood the question? – fmw42 Nov 14 '17 at 22:55