Converting PSD file to JPG using graphic magick - graphicsmagick

I 'm trying to convert psd file to jpg format file by using following commands:
gm -convert [input file name].psd -colorspace rgb -resize 150x150 -strip -quality 92 - sharpen 2 [output file name].jpg
gm -convert -clip -negate [input file name].psd -thumbnail 150x150 [output file name].jpg
Both the commands are working fine.But for some psd file having rgb colorspace it does not generate correct rendition.
Any suggestions??

Have you tried ImageMagick? ImageMagick has the same command-line, but also have a thumbnail of PSD, get by this:
convert a.psd[0] b.jpg

The PSD reader in GraphicsMagick is not very robust and PSD is very complex and poorly documented. The best free implementation I have seen is in The GIMP.

I have just created a Node module that deals with PSD files from the CLI.
For all non-Windows users out there that don't want to crack Photoshop just to see a proper rendered file (Gimp is not really a solution and has a poor understanding of modern PSD files).
Instructions from the Github repo :
Install it :
npm install -g psd-cli
Convert myfile.psd to a new myfile.png :
psd myfile.psd
Hope you find this useful ! Any feature requests is most enjoyed, I have a ton in mind and help with improving the code is appreciated :)

Related

Copy all EXIF information from one jpg to another jpg in R

I read a jpg image into R as well as all of its EXIF metadata.
Then I do some manipulation to the image and write the output as jpg.
How could I copy all EXIF information to the new jpg file?
(I understand I will need to modify only few tags).
I find very useful information on how to read the EXIF metadata in R
(eg, packages Thermimage or exiftoolr), but not on writing them.
The exiftoolr package allows you to call exif_call() to run any command that the underlying exiftool can do. Examples are included here: https://exiftool.org/examples.html. So if you wanted to run the following command in R you would translate
exiftool -artist="Phil Harvey" -copyright="2011 Phil Harvey" a.jpg
into
exiftoolr::exif_call(args=c(
'-artist="Phil Harvey"',
'-copyright="2011 Phil Harvey"'
),
path="a.jpg")

Why doesn't the nops_scan function of the R package exams create zip file?

I am trying to run the tutorial for written exams in the exams package (http://www.r-exams.org/tutorials/exams2nops/). Everything works fine until I am about to process the scanned documents using the nops_scan function, which normally should create a zip file.
In the console it says "Creating ZIP file", but nothing happens after that. Last output:
> nops_scan(dir = "nops_scan")
Loading required namespace: png
Reading PNG files:nops_scan1.png: Trimming PNG, rotating PNG,
extracting information, done.nops_scan2.png: Trimming PNG, rotating
PNG, extracting information, done.
Creating ZIP file:
... and then nothing happens.
I have tried to run dir("nops_scan") and it confirms that no zip file has been generated and placed in this folder.
The files in the tutorial are png-files, so what the tutorials says about running pdftk and ImageMagick, should not apply. From the tutorial: "Note that if there were PDF files that need to be scanned, then the PDF toolkit pdftk and the function convert from ImageMagick need to be available outside of R on the command line."
Could the problem still be related to the above comment about pdftk or ImageMagick? (Which program is used to create the zip files?) I do not know how to make these programs "available outside of R", so instruction on this would be appreciated!
The base zip() function from the tools package is used, see ?zip. If you are on Windows maybe you need to install the Rtools? These are available from CRAN at https://CRAN.R-project.org/bin/windows/Rtools/.
PDFTk and ImageMagick are not involved in this case, they are only needed to convert PDF files to PNG which can then be processed in R. (And just in case anybody else is looking for this information: http://www.R-exams.org/tutorials/installation/ provides links to installation files for these applications.)

Convert hex code from TIFF to readable format

I am trying to read in the JPEG table from a TIFF file to locate sub-images in the TIFF file. (This is coming from a whole slide image svs file and I am trying to delete the label and macro image.) The JPEG table is hex encoded and I can't figure out to turn it to readable information to locate the sub-images.
I have tried unpacking the values. I don't want to save the file and open in Linux. I want to do this from within a jupyter notebook. I've tried for a while using "unpack" from IO core tools which didn't work. I also briefly tried BeautifulSoup, but it tells me that there is an invalid start byte. Here's the first line I am trying to decode:
b'\xff\xd8\xff\xdb\x00C\x00'
This line should return something like "JPEG image file..." I think if I can translate this line I can do the rest of this JPEG table.
Used a python TIFF package to help find the pages of the TIFF file I was looking for.

Convert jpg images to webp

I'm trying to convert .jpg images to webp format.
I have site in WordPress, and I need to add webp to my images. I read https://developers.google.com/speed/webp/ but it does not work for me.
And I tried using https://wordpress.org/plugins/wp-webp/ but that also does not work.
And I tried this article, also doesn't work http://www.wpexplorer.com/webp-files-wordpress/
Can anyone help me?
apt get install moreutils
apt get install parallels
parallel -eta cwebp {} -o {.}.webp ::: *.jpg
works with *.png too 100000 images at the time if you want
One image at the time can be done with cwebp -q 100 image1.jpg -o image1.webp
Sorry got this from another thread but he missed a dot before webp
To convert images from WebP format into JPG and PNG format you can use WebPconv 6.0 (Windows only).
It's a free app and you can find it here.

mencoder settings for PowerPoint

I have a series of jpg files that I would like to encode into video with mencoder. Currently I'm using the mpeg codec like so:
mencoder mf://*.jpg -mf fps=30:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=8000 -o video.mp4
...but I've been having some problems with mp4 and PowerPoint. Can someone offer a recommendation for an encoding format that plays nicely with PowerPoint and provide an example? asf maybe? I am a newbie when it comes to video encoding.
i'm using mencoder version 4.4.6

Resources