Save Xlib window to eps file - x11

Is it possible to capture a xlib window and save it to an eps file?

Use any screenshot mechanism (GNOME has a hotkey built-in to launch http://en.wikipedia.org/wiki/Gnome-screenshot for example but there are ton of ways) to get a PNG or other bitmap file.
Then just use "convert" on the command line or an app such as GIMP to convert to eps.
From the command line:
convert screenshot.png screenshot.eps

Related

Why won't cmdwiz display my bmp image converted from png by imagemagick?

My batch script generates a bmp preview image using imagemagick and I want to display it in a cmd window using cmdwiz but it won't show up.
I tried generating a png then converting it to a bmp with "-type truecolor" but it didn't work. It did work when I converted the png using MS Paint though.
You need to establish the difference between the BMP that ImageMagick generates and the BMP that MS Paint generates to deduce what you need to tell ImageMagick to do differently. So, use:
magick identify -verbose IM.BMP > IM.TXT
magick identify -verbose MSPAINT.BMP > MSPAINT.TXT
Now use whatever tool Microsoft supplies to find the difference between IM.TXT and MSPAINT.TXT.
As an alternative, you can use exiftool, i.e.
exiftool IM.BMP
exiftool MSPAINT.BMP

Specifying image dimensions like Gimp in ImageMagick

I am editing an image in Gimp with dimensions and size specified as below.
How to use the same parameters in ImageMagick? (I tried something like below, but unable to get the desired output):
convert clipboard:image -crop 741x610+274+57 image.png
And how to copy this image back to clipboard?
I don't currently have a Windows system around (the clipboard: thingie works only on Windows -- for Mac and Linux there are no equivalents within ImageMagick).
But I think it should work like this:
convert clipboard: -crop 741x610+274+57 +repage clipboard:
However, I'm wondering why you use the clipboard for output at all? Why do you require to write back to the clipboard? (There may be other means to achieve what you want...)

gifsicle.exe on Windows 7 - Invalid argument error

I'm trying to build a GIF image from several different GIF images using GIFSICLE.exe utility. Here is the link to the utility that I'm referring here: http://www.lcdf.org/gifsicle/
I've all the individual GIF frames saved in "Frames-GIFs" folder and the gifsicle.exe is also placed in the same folder. Here is the command line that I'm passing:
gifsicle --delay=10 --loop *.gif > test.gif
I following error:
gifsicle: *.gif: Invalid argument
Can someone please guide me to build a proper Command Line for gifsicle and make animated GIF using a series of GIF image files?
*P.S.: This is an attempt to make a Screen Recorder in Visual Basic that records screen activity in animated GIF image format. I've completed code that takes screenshots of predefined area at a preset frequency (delay parameter for gifsicle). If you can suggest any better alternative, your suggestions are welcome. :-)

How to convert a source code text file (e.g. asp php js) to jpg with syntax highlight using command line / bash routine?

I need to create images of the first page of some source code text files, like asp or php or js files for example.
I usually accomplish this by typing a command like
enscript --no-header --pages=1 "${input_file}" -o - | ps2pdf - "${temp_pdf_file}"
convert -quality 100 -density 150x150 -append "${temp_pdf_file}"[0] "${output_file}"
trash "${temp_pdf_file}"
This works nice for my needs, but it obviously outputs an image "as is" with no "eye-candy" features.
I was wondering if there's a way to add syntax highlighting too.
This might come handy to speed up the creation of presentations of developed works for example.
Pygments is a source highlighting library which has PNG, JPEG, GIF and BMP formatters. No intermediate steps:
pygmentize -o jquery.png jquery-1.7.1.js
Edit: adding source code image to the document means you are doing it wrong to begin with. I would suggest LaTeX, Markdown or similar for the whole document and source code document could be generated.
Another easy/lazy way would be to create an html document using pygmentize and copy-paste it to the document. Not professional, but better than raster image.
Here's how I do it on my Mac:
I open up the file with MacVIM. MacVIM supports syntax highlighting.
I print the file to a PDF. This gives me a paged document with highlighted syntax.
When I print, The program Preview opens up to display the file. I can Export it to a jpg, or whatever my hearts desire.
I don't have a Mac
This works with Windows too.
You have to get VIM although Notepad++ may also work. Any program editor will support syntax highlighting and allow you to print out with the highlighted syntax. So, pick what you like.
You have to get some sort of PDF producing print driver such as CutePDF.
Converting it to a jpg. I think Adobe Acrobat may be able to export a PDF into a JPG, or maybe the print driver can print to a JPG instead of a PDF. Or, you can send it to a friend who has a Mac.

How to modify a .png image with VBScript

I have a need to select a portion of a .png file, with specific cordinators, and delete this area then save the file back with the same name.
I would appreciate if you can help to come up with a VBScript script that can accomplish this task.
It would be great if all proesses happen in the background, but it would be ok too if the image file has to be open and visible. Thanks a bunch!!!
A PNG file, like any other binary file can be edited with CMD or VBS.
A PNG file layout is as follows:
File header
"Chunks" within the file
Pixel format
Transparency of image
Compression
Interlacing
Animation
Read the PNG format in RFC 2083 to know how to edit/create a PNG file at binary/bit level.
To speed up the editing process, libraries are available for application level editing.
Here are some VBA codes for image manipulation.
ImageMagick also provides libraries that can be accessed via VBS for image editing.
Here's a VBScript Image Class for bmp and pcx files (which PNG can be converted to before editing via WIA).
Loadpicture function described here doesn't seem to support PNG, but this discussion might solve it.
The Windows Image Acquisition Library v2.0 supports PNG, BMP, JPG, GIF and TIFF image formats, and comes with Windows Vista and later versions. Sample scripts are available to demonstrate "image manipulation using the ImageFile object". The Vector.ImageFile property also "creates an ImageFile object from raw ARGB data".
More sample codes here & here show how to rotate, flip, scale, crop, etc with WIA Image constants in vbs. To remove unwanted areas of image (with given coordinates), use the crop function.
Here's a discussion of WIA 2.0 image editing on stackoverflow.
VBScript doesn't have any image editing functions, so you need an external tool for that. For example, GIMP can do image processing from the command line (see here). ImageMagick provides a scriptable component in addition to the command-line interface (details here).
To run a command line from a VBScript script, you can use the WShShell.Run method. To create an instance of a COM scriptable component, use the CreateObject function.

Resources