TCL - index param on "image create" with multitiff wont do with Img 1.4.14 - image

I'm currently using the Image Lib Img 1.4.14 which does anything I ever wanted from a graphics LIB :)
However, I encounter just one problem while using MultiTIFF images. It is no problem to display the first picture of that tiff, but whenever I want to access any following images in that tiff, I don't receive any usable response from it.
Just an example line like this produces no output:
image create photo imgTest -file $filename -index 1
while
image create photo imgTest -file $filename
always gives me the first image correctly.
I tried tons of different approaches in calling the subsequent pctures to no avail. Thus I still think that the Img Lib is totally capable of doing it, so the problem seems to be on my side. What am I doing wrong? Any help is appreciated.
Additionally tried:
several different calls to the loading line, like :
image create photo imgTest -file $filename -format [-index 2]

To pass options to the image format handler, you need to use the -format option. But that's the name of the format! Well yes, the first word of it is. The subsequent words are the options. (If you don't pass options, you can rely on auto-detection.) That means you need something like this:
image create photo imgTest -file $filename -format [list tiff -index 2]
I'm not 100% sure that the name of the format handler is right; tiff is a guess.

Related

Convert entire folder to grayscale using image magick?

Another person asked this question but the answers are not adjusted to the average civilian comprehension.
I am trying to convert an entire folder to grayscale, using image magick.
I want to convert the entire folder of JPG and PNG images that are in color to grayscale.
Things that I know: I know to open notepad, copy-paste text aka code, save it as a bat, save it in a specific folder, and click run.
Anything beyond what is listed is not within my skills.
I see here on this website a million questions that I also have but answers are not end-user friendly. For example, no one mentioned that we can't have folder names with spaces in the Run command line window.
Codes are not full but in fragments throughout messages and there is no conclusion at the end when the problem is solved that gives step-by-step procedure on how to solve the problem.
Can anyone help with the full code I need to have in notepad for the batch procedure to work?
Thank you.
No need for Notepad. Start a Command Prompt and change directory to the one containing your images. So if your images are in HOME/Images, type:
cd Images
then press Enter/Return. Then type:
magick mogrify -colorspace gray *.png *.jpg
then press Enter/Return and you're finished.

convert .nl image file

I have a list of hundreds of hyperlinks that are to image files from my supplier. The problem is they have a .nl file extension. Here's an example:
http://www.netsuite.com/core/media/media.nl?id=66821&c=ACCT120207&h=bad4512e36320e5b2239
I need to use some sort of batch process to find all those image files and convert them to a .png or .jpg link (or batch download all the images then rename them)
Do you have any suggestions?
As you don't show an excerpt from your list of URLs, nor state your Operating System, it is rather hard to help you process the entire list.
However, for the one URL you show, you can retrieve the image and store it locally as "image.jpg" like this:
curl -L "https://system.netsuite.com/core/media/media.nl?id=101065&c=ACCT120207&h=ff667401c82a7dc4c2e1" > image.jpg

How can I generate a thumbnail of a specific page in a PDF on the command line in OS X?

I need to be able to generate a png thumbnail of a specific page of a PDF document in OS X.
I can use 'qlmanage -p MyFile.pdf -o outputDir -s1000' to get a 1000-pixel wide PNG of the first page. This works perfectly, and is almost exactly what I need. The only missing piece is being able to specify a certain page number of the PDF.
Can this be done with qlmanage, or some other command-line utility?
ImageMagick ought to be able to help:
convert -resize 10000x10000 MyFile.pdf[2] MyOutput.png
Where 2 is the page number. Enjoy!
You can use Aspose.Pdf to generate a thumbnail (or image) of any page. Very reliable and generates a perfect image (as good as Acrobat). Only downside is it takes ~20 SECONDS to generate a single thumbnail. And that sucks. Code is as follows:
Document document = new Document(pdfPath);
Page page = document.Pages[pageNum];
document.RemoveMetadata();
page.Flatten();
page.SendTo(new PngDevice(page.PageInfo.Width, page.PageInfo.Height), pngPath);
document.Dispose();

JPEG Shows in Firefox but Not IE8

I'm working on a Sidebar Gadget and cannot get my JPEGs to show up (PNGs work). When I try to open the file by itself in IE8 it doesn't work. Firefox, of course, can open it fine.
JPEG Details:
Dimensions: 1080X900
180 dpi
Bit depth 24
Color representation: uncalibrated
I've found some things talking about the images being compressed incorrectly (?) but I haven't been able to get it working...
Any clues?
IE8 drops support for CMYK JPEG and renders them as the infamous red X without so much as a warning.
If you have ImageMagick:
identify -verbose image.jpg
will show you the image colorspace. If it's CMYK, you can convert to RGB with:
convert broken.jpg -colorspace RGB fixed.jpg
If you need to do CMYK to RGB conversion on a whole batch of JPEG-images, this command may be helpful to you:
for i in *.jpg; do convert "$i" -colorspace RGB "$i"; done
PS: If you'd like to see what is going on, just add -verbose:
for i in *.jpg; do convert "$i" -colorspace RGB -verbose "$i"; done
I had a similar issue with IE8 not displaying two JPEG images. FF, Safari, Chrome all displayed them without complaint but IE acted as if the files were not there. I have no idea what was going on, but a quick image conversion to gif or png fixed the problem. Just another in a long line of confirmations that IE sucks.
Had similar problems with existing images, which will not show up in IE8.
Problem is, as converter42 says: CMYK-Images
Convert them to RGB colorspace and all is good
The Solution with the PNG is not the best, because PNG files can be MUUUCH larger than JPGS.
If you are using photoshop for creating the jpgs. Try the below.
Open the file and go to 'Image' menu
Go to Mode
Select RGB
Save and upload to server.
This should work.
Why are you dealing with the image at 180 dpi and not the 72dpi screen resolution? At screen resolution the image will be roughly double that size. Still, the size is manageable for any browser.
When creating a gadget, you should be using PNGs for all the elements of the gadgets. Are you having issues displaying JPEG photos?
Have you looked for the yellow bar at the top of IE that blocks certain suspicious content from being loaded (popups, activex, javascript, etc.)? If it appears, try telling it to "allow".
Lastly, what are you using to compress your images to JPEG?
EDIT: If you want to do batch conversion use the batch converter in photoshop or use the Actions panel to record the conversion process for a single image, then replay the action on an entire folder. Additionally, you can save this action to a "droplet" which is a small application containing the action that you can drop an image or folder on top to.
Alternatively, if you don't fell like learning Actions, XNView is an excellent image viewer and converter that supports something like 160 different image formats and can batch convert and batch rename huge lists of files.
I fixed this issue by opening the CMYK JPEG file in Windows Paint and then saving as a JPEG, which Paint encodes as RGB by default. Not a great solution because I'm sure that Paint's converter is not as robust as Photoshop's, but this can be a quick fix if the job needs to be done now and there's no access to the tools above.

how to convert rtf to image format ( jpg/png..)

i need to convert rtf document that contains images (jpgs/pngs ) to image format
jpgs or pngs programmaticly , do you have any ideas on how to do it ?
on server side (web)
Thanks
You can use a virtual printing device, for example: http://www.joyprinter.com/
If by programmatically, you mean scripts, you could script your RTF program to open files, then export to PDF, then export the PDF to an image. At least, this kind of operation is relatively easy on OS X. You could probably do it entirely in Automator, using TextEdit and Preview. Otherwise, on OS X you could also try accessing the core services that would do the same thing. No clue on Windows though. Hope that helps!
You might want to write a bash script to be executed by a cronjob. So at a defined time, or after a defined period, you will have your rtf files converted into jpgs.
Though I don't know if this might satisfy your "programmatic" need .. here is how to do this conversion:
To convert rtf files contain "advanced" features like images, as in your case, you need unoconv, which requires libreoffice to be installed.
unoconv -f pdf "${input_file}"
Otherwise, just for reference because it's not your case, if the rtf files contain only simply text you can avoid the requirement to have libreoffice installed by using a cascade conversion like
// convert rtf to txt
unrtf --text "input_file.rtf" > "temp.txt"
// convert txt to pdf
enscript "temp.txt" -o - | ps2pdf - "temp.pdf"
// convert pdf to jpg
convert -quality 100 -append "temp.pdf" "output.jpg"
// remove temp files
trash "temp.txt" "temp.pdf" // or rm if you prefer

Resources