I am optimising a whole directory of images with 10000 png images. I did use the brute to test and for the first 100 it was method 11 is the best for compression.
You know that pngcrush uses like 130 different methods to try on an image and this is really taking too long.
I did try to input -brute -m 11, but this will let it start from 11 and go up.
I only need method 11 to be applied.
Here is my script :
#!/bin/sh
for png in `find $1 -name "*.png"`;
do
echo "crushing $png"
pngcrush -brute -m 11 "$png" temp.png
mv -f temp.png $png
done;
Any idea how to work around this and only apply method 11 ?
btw pngcrush works best with my images so please don`t suggest optimisers like pnggauntlet or pngoptimizer.
Thank you all
Kind Regards
My bad ... I shouldn`t have used the -brute command and it should have worked :-)
Related
Spanish chracter and some spaceial chracter not allowed in Imagmagick when creating images from pdf.
There is showing error message "no decode delegate for this image".
Can i ignore that text while creating images from pdf.
Any solution for this?
Thanks!
Try running the following:
convert -list configure | grep -i "DELEGATES"
What does that mean?
**convert -list configure** - displays your imagemagick configuration
**grep -i "DELEGATES"** - takes the results from above and does a case insensitive search for what you're looking for, in this case, you're looking for the section marked DELEGATES
This should return all of the packages that you need in order to run your command.
Using your favorite package manage ( apt, yum,brew, etc ), install those packages ( including their development packages ), then try again.
Here is a thread you can check out, where someone had a very similar issue:
http://www.imagemagick.org/discourse-server/viewtopic.php?t=22488
Hope this helps!
When searching for the word find in the PDF file in this Link before Ghostscript optimization the results will give pages number 4,7 and 13 but after the optimization it gives only pages 4 and 13 ignoring page number 7, the script im using for the optimization :
D:/gswin64c -sDEVICE=pdfwrite -dMaxSubsetPct=100 -dAutoRotatePages=/None -dMaxInlineImageSize=0 -dPDFSETTINGS=/ebook -dColorImageResolution=96 -dDetectDuplicateImages=true -dColorImageDownsampleThreshold=1.1 -dDOPDFMARKS -dUseTrimBox -sOutputFile="D:/temp/search_text.pdf" -dNOPAUSE -dNOGC -dBATCH -dNumRenderingThreads=8 -c 50000000 setvmthreshold -f "D:/temp/iphone_user_guide.pdf"
I've tried to add several fonts related parameters to the script such as -dEmbedAllFonts=true and pointing to fonts path also I've tried to play with the parameters by eliminating some but with no result
what could be the cause of this problem?
Ghostscript doesn't do 'optimization'. See my answer here:
GhostScript issues with a CropBox
for some details on what it does do.
Wihtout seeing your file I cannot tell you for certain what the difference is, but most likely the missing text has been drawn as images instead of text for some reason.
By the way, a lot of the options you are sending have absolutely no effect (eg NumRenderingThreads, for a device which doesn't do rendering). You should NOT select -dNOGC, that's a really bad idea, -dDOPDFMARKS is already set for the pdfwrite device.
I want to find out which images in the project are actually used. When I try to find names of images that were set programaticly, I can see them in the relevant classes when searching. This is not the case for images that were set in the xib. Is there some workaround to find if the image is used in some xib?
Try using the utility app Unused by Jeff Hodnett. I've used it before and had success with it.
You can from the command line, yes.
As always, grep is your friend:
$ cd ~Source/Books/Beginning iOS 6 Development/ch04/Control Fun/Control Fun/en.lproj
$ grep png *
BIDViewController.xib: <string key="NSResourceName">apress_logo.png</string>
BIDViewController.xib: <string key="NS.key.0">apress_logo.png</string>
I'm trying to write a script to take a PDF and increase the brightness/contrast such that my scanned handwritting is actually readable. I am able to do this with Photoshop (which is really tedious), but I can't figure out what RMagick methods to use to produce a similar result.
Any pointers? Thanks for the help.
I ended up using Fred's ImageMagick scripts to make the handwriting readable see : http://www.fmwconcepts.com/imagemagick/
I ended up not using RMagick for this part; instead I just called imagemagick's convert terminal command from ruby. It is a little bit convoluted - but it worked for me. Some sample code is below:
localthres_script = '~/Downloads/test/localthresh.sh' # CONSTANT LOCATION
params = '-m 3 -r 25 -b 20 -n yes'
pdf = Magick::ImageList.new("#{dir}/#{pdf_name_wo_ext}.pdf")
i=1
pdf.each do |page|
image_name = "#{pdf_name_wo_ext}_#{i}"
puts "==> Enhancing images..."
%x[#{localthres_script} #{params} #{dir}/#{image_name}.png #{dir}/PDF_SCRIPT/enhanced/#{image_name}.png]
puts "==> Moving images..."
%x[mv #{dir}/#{image_name}.png #{dir}/PDF_SCRIPT/original/#{image_name}.png]
i = i+1
end # each
I know this isn't the cleanest code, but it worked for me.
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