Showing posts with label imagemagick. Show all posts
Showing posts with label imagemagick. Show all posts

Tuesday, October 29, 2013

Linux command to take screenshot

On newer versions of KDE when you press the PrintScreen button, a dialog pops up asking you if you want to copy or save a screenshot.

You can also do screenshots from Gimp: Open Gimp, select File -> Create -> Screen Shot...

To be cool or on older versions of Linux you might want to be able to take screen shot using a command line terminal (virtual terminal, you still need to be in X Windows).

Enter the following command:
import -window root <location to put image>
e.g.
import -window root ~/screenshot.jpg

So then you can easily press Alt + F2, enter the command above. Then you won't get the terminal window in your screenshot.
On my system, once you have done so once, the next time you start entering the text it autocompletes.

Note: You need ImageMagick installed as import is included in that package.

Source: http://www.linuxforums.org/forum/newbie/10213-print-screen-available-linux.html

Wednesday, May 5, 2010

Postscript delegate failed for ImageMagick PHP library

For ImageMagick in PHP through the library Imagick the following error may occur for versions ImageMagick-6.3.5 to ImageMagick-6.4.2:
Postscript delegate failed `': No such file or directory

This is a bug and the error appears when one is trying to use the readimageblob function to read a PDF file.

The fix has been posted and the bug is no longer present. See http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=11989. So to fix it get the latest release from http://www.imagemagick.org/.

Some installations (like server environments), haven't got the latest version and cannot install it. For these, it is possible to work around this bug, by using a temp file.

So instead of:
$im = new Imagick();
$im->readimageblob($data);


Use:
$im = new Imagick();
$temp = tmpfile();
fwrite($temp, $data);
fseek($temp, 0);
$im->readimagefile($temp);
fclose($temp);


(This would typically be followed by for example:
$im->setImageFormat("png");
$data = $im->getimageblob();
)

Sources: http://markmail.org/message/6mg3lxi26gd5fluv#query:readimageblob%20Postscript%20delegate%20failed+page:1+mid:6mg3lxi26gd5fluv+state:results

If this doesn't fix it for you, also check out: http://stackoverflow.com/questions/588918/imagemagick-imagick-convert-pdf-to-jpg-using-native-php-api

Tuesday, April 6, 2010

Imagemagick reading pdfs under Apache and Windows

Getting "Apache HTTP Server has stopped working" when trying to read a pdf file using the PHP imagick class when running Apache?:

If
<?php
$im = new imagick('file.pdf[0]');
?>

breaks your server. Try installing the latest Ghostscript windows binaries: http://pages.cs.wisc.edu/~ghost/

You should also have gotten an error if you tried to convert the pdf in commandline:
Unrecoverable error: undefinedresource in setcolorspace
Operand stack:
--nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- DefaultGray ColorSpace
START 0 2568152 1228867 1461800 167944 true 1134 5 <9>
END PROCS 6 2568152 1240166 1461800 169328 true 1133 5 <9>
gs_std_e.ps 13 2588248 1246221 1461800 170712 true 1133 5 <12>
gs_il1_e.ps 20 2588248 1248404 1461800 170712 true 1133 5 <15>
END FONTDIR/ENCS 25 2588248 1248582 1461800 170712 true 1133 5 <21>
END DEVS 31 2591744 1255606 1461800 170712 true 1133 5 <21>
END STATD 37 2591744 1262786 1461800 172336 true 1133 5 <45>
END GS_FONTS 44 2631936 1293632 1461800 172336 true 1134 5 <51>
END BASIC COLOR 50 2631936 1300193 1461800 172336 true 1132 5 <54>
END LEVEL 1 COLOR 55 2631936 1301921 1461800 172336 true 1132 5 <57>
END IMAGE 61 2652032 1308551 1461800 172336 true 1132 5 <60>
gs_btokn.ps 67 2652032 1311993 1461800 172336 true 991 4 <63>
gs_dps1.ps 73 2652032 1313338 1461800 172336 true 991 4 <63>
gs_dps2.ps 78 2652032 1315345 1461800 172336 true 991 4 <63>
gs_type1.ps 84 2652032 1316871 1461800 172336 true 991 4 <63>
gs_lev2.ps 93 2672128 1334882 1508160 219096 true 991 4 <63>
BEGIN RESOURCES 96 2672128 1337010 1508160 219096 true 991 5 <64>
END CATEGORY 100 2672128 1338270 1508160 219256 true 991 6 <64>
While reading gs_patrn.ps:
%%[ Error: typecheck; OffendingCommand: get ]%%
START 297633 2756688 1417603 1508160 221464 true 995 6 <67>
END PROCS 297638 2756688 1428886 1508160 222848 true 993 6 <67>
gs_std_e.ps 297645 2776784 1434941 1508160 224232 true 993 6 <70>
gs_il1_e.ps 297649 2776784 1437124 1508160 224232 true 993 6 <73>
END FONTDIR/ENCS 297653 2776784 1437302 1508160 224232 true 993 6 <79>
END DEVS 297657 2780280 1444326 1508160 224232 true 993 6 <79>
END STATD 297662 2800376 1454858 1508160 225856 true 993 6 <103>
END GS_FONTS 297667 2820472 1482354 1508160 225856 true 993 6 <109>
END BASIC COLOR 297672 2820472 1488915 1508160 225856 true 991 6 <112>
END LEVEL 1 COLOR 297677 2840568 1493995 1508160 225856 true 991 6 <115>
END IMAGE 297683 2840568 1497297 1508160 225856 true 991 6 <118>
gs_btokn.ps 297689 2840568 1500739 1508160 225856 true 991 6 <121>
gs_dps1.ps 297694 2840568 1502084 1508160 225856 true 991 6 <121>
gs_dps2.ps 297700 2840568 1504091 1508160 225856 true 991 6 <121>
gs_type1.ps 297705 2840568 1505617 1508160 225856 true 991 6 <121>