Converting images to .xcf format - image-processing

Is it possible to convert an image, or batch of images, to a .xcf or .psd file? Using ImageMagick's convert tool didn't work, but so far my attempts to look at doing this using gimp from the command line have been unsuccessful.

An answer can now be found here. Put the following code into a script.
gimp -n -i -b - <<eof (let*="" (="" (file's="" (cadr="" (file-glob="" "*.png"="" 1)))="" (filename="" "")="" (image="" 0)="" (layer="" )="" (while="" (pair?="" file's)="" (set!="" image="" (car="" (gimp-file-load="" run-noninteractive="" file's))))="" layer="" (gimp-image-merge-visible-layers="" clip-to-image)))="" filename="" (string-append="" (substring="" 0="" (-="" (string-length="" file's))="" 4))="" ".xcf"))="" (gimp-file-save="" filename)="" (gimp-image-delete="" image)="" file's="" (cdr="" (gimp-quit="" eof<="" pre="">
enter code hereIt's a script that batch converts to any file format that gimp can read. Just substitute ".xcf" on line 2 and ".png" on line 6 for whatever file formats you need

Related

ETL file parsing using powershell script

#Defining the etl file
$etlFile = 'test.etl'
#Retrieving the content
$log = Get-WinEvent -Path $etlFile –Oldest
Is there any other way of parsing .etl file to read etw events?
There is no built in command for reading an etl file with PowerShell but calling tracerpt.exe in windows\system32 for converting the etl file into xml (the file is always called dumpfile.xml) seems to be a simple solution:
tracerpt.exe .\WindowsUpdate.20220813.100210.641.1.etl -lr
([Xml](Get-Content .\dumpfile.xml)).Events
([Xml](Get-Content .\dumpfile.xml)).Events.Event
([Xml](Get-Content .\dumpfile.xml)).Events.Event.EventData
([Xml](Get-Content .\dumpfile.xml)).Events.Event.EventData.Data
etc.
See also Converting ETL to XML in powershell using traceprt, issues with dashes and spaces in arguments

Convert png image fingerprint to minutiae xyt fingerprint format

I am following Minutiae cylinder code paper and it uses ISO19794-2 or xyt format for minutiae. I tried NIST BIOMDI and NBIS. Both didn't work.
Have you tried mindtct distributed with NBIS.
$ ./bin/mindtct -b ./sd09/vol_01/sd09/vol_01/crd_0000f/crd_0000f_01.png ./outf
Will generate a bunch of files including ./outf.xyt.

Remove command injection in rails

So I have a helper that uses ImageMagick and a method inside it which enforces zbar on command line to extract QR data from an image. The image source has to be parametric.
qr_code_data = %x(zbarimg -q #{src})
brakeman gives me a command injection warning here, obviously. Using only backticks gives the same warning, and while system would produce the result required, it returns true and not the output. I don't want to use a QR-decoding wrapper/gem, or Open3. I need to know can I sanitise my image source as a parameter to avoid command injection, except by using the two options I have mentioned.
ImageMagick generally supports using STDIN for input. IO.popen supports replacing stdin of the subprocess with the contents of a file. Try the following:
qr_code_data = ""
IO.popen(['zbarimg','-q','png:-'], :in=>[src]) do |pipe|
qr_code_data = pipe.read
end
Replace png above with your actual image format or remove png: entirely to allow ImageMagick to determine the file type from the input's magic number.

TCPDF - How to generate a TTF file from PHP?

I am using TCPDF 6.0.20, PHP 5.3.8.
Since my PDF will contain some Chinese Character (Simplified and Traditional), I decide to use font name: cid0cs.
Now, since a lot of users replied that they don't have that font installed, I need to embed this font to the PDF.
However, in http://www.tcpdf.org/fonts.php it says how to embed a TTF file using addTTFfont(), but NO WAY to create that font.
The only file that I found in tcpdf/fonts/ is cid0cs.php, which is NOT a TTF file.
I tried to run the script in tcpdf/tools/tcpdf_addfont.php and use the command line below:
c:\tcpdf>php tools/tcpdf_addfont.php -t CID0CS -o . -i fonts/cid0cs.php
and it returns:
--- ERROR: can't add fonts/cid0cs.php
How can I create the cid0cs.ttf file so that I can embed it using addTTFfont()?
I found the solution and record the process in my blog post below:
http://alucard-blog.blogspot.hk/2013/06/tcpdf-how-to-display-chinese-character.html
The key point is: I found the font that can display Traditional and Simplified Chinese.
cmd and run php
run this command : \ABSOLUTE PATH TO\tcpdf_addfont.php -i \ABSOLUTE PATH TO\myfont.ttf
if it works fine, you will find 3 files of myfont in /TCPDF/fonts
you might find some help here : http://queirozf.com/entries/adding-a-custom-font-to-tcpdf

Compare tool with command line for mac

I am looking for command line tool to do diff between two HTML files.
I have analysed kdiff3/command line of bbedit but my problem is dont want to open any GUI.
I want to write a java program to call command line options of the diff program to compare html files and save result in a different file or probably show in a report file.
Any pointers will be very helpful
Thanks
Vishal
If you have xcode installed, you can call up opendiff, it's a (graphical) compare tool from the command line. From it's man page:
opendiff file1 file2 [-ancestor ancestorFile] [-merge mergeFile]
opendiff dir1 dir2 [-ancestor ancestorDirectory] [-merge mergeDirectory]
I thought mac had diff built in. Have you tried using diff from the mac terminal?

Resources