apply same curve-color to tiff in batch in GIMP - colors

I would like to apply a specific color curve to some 2000 .tif files.
I am a Windows user and so far I have used GIMP for photo editing.
Using Gimp 2.10 I was able to perform such task working on .JPG files using the batch Image Manipulation plug-in (bimp v 2.6; https://alessandrofrancesconi.it/projects/bimp/).
Work flow so far for Jpegs in GIMP-2.10:
Using I created a color curve working on a jpg file (Colors-> curves).
once happy with corrections I saved the curve in an external file ("myset") which hasbeen saved in '\User\appData\roaming\gimp\2.10\curves'
using bimp plug in I choose Add->color correction
in the new window that pop-up I then select only the checkbox "change the color curv from external file" (or similar, menus are not in english...sorry) and navigate to my "myset" curve file.
finally run the batch
When I tried to do the same BUT WITH the .tif files, I got warnings of the kind "unknown filed tag encountered" at the step of importing in bimp the images to process.
That said, I can open the individual tif files in Gimp (File -> open...).
When I do, I still get the warnings "unknown filed tag encountered", but i can click "OK" on the message window and continue importing the file.
Now the "import TIFF" window show me a "Page 1" icon in the top part, then I can choose if opening the file as "levels" or "image". Both choices seem to give the same result.
At that point I can apply my "myset" curve to the file from the tool Colors-> curves.
One potential solution I've been thinking of is to write a script to do this and call it from the command line. I found something along that line here: https://www.gimpusers.com/forums/gimp-user/11100-curves-spline-batch .
Unfortunately:
I have no experience in writing script-fu scripts and very few on command line.
looking at the example in the above link I cannot figure out how/where to point to the "myset" curve in the script.
looking into the Procedure Brouser I do not know which is the one corresponding to the Color->curve tool. ( possibly someting like gimp-drawable-curves-splines, but again I dont know how to have that refer to "myset")
A copy of my "myset" curve and a some .tif esample files can be found here.
Dows anyone have suggestion on perform batch curve color changes on these tif files similarly to what I describe for the jpg? I am open to other solution then GIMP (but for example I cannot open those tif in rawtherappe - don't know why - so that is less of an option)
IMPORTANT: the I need to preserve the tiff metadata (they're georeferenced)

Related

How can I display an image sequence as a volume in ParaView?

As a replacement for ImageJ's 3D-Viewer I'm trying to display a sequence of microscopic images as a volume in ParaView 5.4.1. I tried following this guide which suggests to save the image sequence as a .raw file with ImageJ, open that in ParaView and manually enter the image dimensions. I'm not seeing the fields where I could enter image dimensions in ParaView though, and clicking "Apply" after loading the .raw file does nothing. Is there another way?
When you open the file, you are probably getting a dialog box titled "Open Data With..." and given a list of file formats that potentially match the file. Make sure you select "Raw (binary) Files". That is the one that reads images as a raw binary array of data and gives you lots of options to specify the size of the array (including reading the files as a 3D stack).
Don't use the one that says "RAW Files". That is a different mesh format used by some CAD programs.

Batch generate height map from images

I have many many .png files and I'm looking for a way to generate height maps (or normal maps) for each of them. I can get the result I want from the gimp normalmap plugin but I need a way to automate the process or an alternative tool. I don't know enough about the underlying algorithms to reproduce them, and very little about cg in general. Is there a library or tool that will do this? I'm not picky about the language as long as the api/interface is high-level enough, though open source is preferable as I don't have access to fancy software at the moment. Thanks!
You can jsut script GIMP itself for that.
I don't know which plug-in you are calling 'normalmap' - or what you mean by 'height map' (height maps I know are just the grayscale version of the image) - but even if it is a third party plug-in, it should be possible to run it through the scripting interface.
Just go to plug-ins-> Python-FU->console - you will be dropped to a Python prompt. Click on the "browse" button - then locate the plug-on you want to call. If you click "apply" - the browser will paste a template for the plug-in call to the Python prompt.
SO, prior to doing that, you may want to test the call: open a sample image, go to the Python prompt, and get a reference to the image by typing:
image = gimp.image_list()[0], then get a reference to the first layer of the image typing drawable = image.layers[0] .
These should be all the data the call for your plug-in would need to be pre-created. Do as above to paste a call to your desired plug-in on the prompt. Note that the names image and drawable above are just variable names - you may chooseyour own - but these are the names that are usually pre-filled in when you pick "apply" from the "Browse" button for a procedure call.
Once you get it working up to here, you can leverage on Python to open all images in a folder, apply the plug-in, and save them back - you can typ e this directly on the console, or later, create a plug-in that will show up in the menus.
import os
for filename in os.listdir('mydir'):
if not filename.endswith('.png'): continue
name = 'mydir/' + filename
image = pdb.gimp_file_load(name, name)
pdb.plug_in_bump_map(......) # use your plug-in here
outputname = 'mydir/' + name.split('.')[0] + '_normal.png'
pdb.gimp_file_save(image, image.layers[0], outputname, outputname)
pdb.gimp_image_delete(image) # just frees the image from memory.
Just press twice and the sequence will be run for an entire folder.
(Note that if you want to run the "bump-map" plug-in there are several parameters that have to be replaced from variable names to the actual values you want).
If that is what you want, and you will be using it a lot, save it as a .py file, and put that code inside a proper function to turn it into a plug-in
- there is a fill examplee for that in my answer here:
GIMP: Create image stack from all image files in folder

How to add comments to folder in linux and view them with mouse cursor

I run simulations for various choices of parameters. For each choice I store the resulting data in a folder, like
/home/me/Documents/MyProject/C=10/1.dat
/home/me/Documents/MyProject/C=10/2.dat
/home/me/Documents/MyProject/C=10/3.dat
...
and
/home/me/Documents/MyProject/C=20/1.dat
/home/me/Documents/MyProject/C=20/2.dat
/home/me/Documents/MyProject/C=20/3.dat
...and so forth.
would like to write a little text file AAA.txt which contains not just the C parameter but all the others too. Then when viewing this folder which contains the data I want to hold my cursor on the little file symbol and have a little box appear. This box should show just the content of AAA.txt, so I can quickly check which set of parameters was used in this particular run.
Anyone know how to do this? I use Ubuntu 14.04
I am not aware of ways to give you a custom "tooltip". As an alternative, you could look into creating custom thumbnails of your .dat files.
See here for how to do that with nautilus; the default file browser for Ubuntu.
Alternatively, you might look into what Gloobus can do for you.

How to highlight portions of a PDF file programmatically (eg. using command line)

I am interested in highlighting portions of a PDF programmatically, hopefully through a command line tool of sorts. My particular PDF file is not OCRed so the text is not searchable, but the particular places that I would like to highlight occur on every page in the same position. I was wondering if there is a tool to do this where I can input the rectangle positions in pixels into the command line tool and it would highlight the relevant portions for me.
Previous Findings
I have looked over the internet and found a few sites noting how to do this by searching for the text. Unfortunately that is not possible for me as my PDF does not have OCR.
I have searched stackexchange for similar questions and found
How to Highlight Text in PDF with commandline (windows)? and https://stackoverflow.com/questions/32713633/how-to-highlight-text-in-pdf-using-acrobat-reader-from-command-line but both were unanswered.
Potential Ideas
The first link had a possible lead with a given link to
Add comments to PDF files automagically with regular expressions
which uses ghostscript to include annotations. Is it possible to use ghostscript to highlight the pages in a similar fashion by coordinates.
The second link mentioned using command line options for the adobe acrobat/reader exe file, but searching the relevant manual for the command line switches does not show any highlighting options. It may be possible that Adobe does not support the highlight option through command line anymore, which would be unfortunate.
My last idea would be using AutoHotkey to create a macro that does an actual highlight for me using a GUI program, but that would be the last resort.
What do you all think? Any ideas on what to do, or things to check out? I am willing to program out a solution and can work out the solution on Windows or Linux if necessary. Thanks in advance.
I would have thought a Highlight annotation was what you wanted.Highlight annotations are a type of text markup annotation and as such take a set of QuadPoints which describe the bounding box(es) to apply the annotation type to.
Since you say you know the co-ordinates this would seem appropriate for your use. Of course, you will have to create the Annotation on every page, and you will have to learn how to program this with a pdfmark, but I believe it should work.
Note that the co-ordinates are in user space (generally 72 points to the inch) NOT pixels, because PDF is not an image format there is no concept of pixels, except for included images.
There are quite a few officially unsupported command line parameters to acrobat or the acrobat reader (acrord32.exe in Windows).
See: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
This includes a parameter to highlight with four integers at left,right,top,bottom that are in some unspecified units but with 0,0 at the top left of the page.
EXCEPT... I have been unable to get this to work.
I can pass in parameters to search and zoom but highlight never shows anything.
For instance:
start acrord32 /n /s /a "search=MS25441&zoom=300&page=1&highlight=0,55,0,65" floorplan1_ABM_cameras.pdf
Opens the files, searches for the string, zooms to 300% but nothing shows for a highlight no matter what coordinates I specify.

Hidden/Open words in an Image file such as PNG or JGP

As far as I can tell my question is not related to topics involved in Stenography or in the win.rar soluations I've seen to this where you are essentially hidding messages.
I am trying to figure out if there is a way to insert code into a file such as a jpg or png with a simple message, that could later be extracted by a program reading the file without having it encoded into the file either by slight differences in pixels or what have you in stenography.
I basically just want a tag along message that is a part of the file itself that is not brought up by the image reader but could perhaps be seen by a text reader of some kind.
I'm not sure how possible this is because I, for the most part don't understand the order/layout of the png/jgp/ect file aside from the RGB pixel code. How does it start, how does the image display tool know to stop displaying ect.
The way I'm envisioning it would be something like:
pngStartCode -> RGBinfo --> png end code so image reader knows to stop -> start sequence that some kind of reader will recognize (possibly a new text reader) -> written text wanted to be communicated -> endcodeforreader
I may just be rambling about something ridiculous here but please let me know if this is at least possible.
You can use following command(Windows command prompt)
Create a text file with your message, say "message.txt"
Now choose target file(it can be any file like a.jpg,a.png,a.exe,..etc), say "image.jpg"
Now execute follwing command
copy /b "image.jpg"+"message.txt" "NewImage.jpg"
Above command will combine files(in binary mode) and creats a new file(in this case NewImage.jpg). Now if anyone opens image they will just see noraml image. If you want to look at text, you have open it with any text editor(Notepad) and scroll down to last, there you can find text.
Here it wont chage any pixels or any thing to image, it just appends text to image.
It sounds like OP is asking about comment tags in the PNG specifications (i.e. adding data but without intent to hide it).
PNG files are broken into "Chunks". The image part is usually divided into several IDAT chunks; the color, size, etc are stored in an IHDR chunk, etc.
The iTXt, tEXt, and zTXt chunks are used for conveying text information associated with the image, so typically you'd look into using a tool to add those types of chunks. tEXt is for just plain text, zTXt is compressed.
More info on the PNG specification including what kinds of chunks are available can be found here, and you find chunk viewers on google.
For convenience at preset time (January 2021) here are a couple tools that will let you view, edit, and add chunks:
Windows 10: http://entropymine.com/jason/tweakpng/
Linux: https://www.systutorials.com/docs/linux/man/n-png/
Mac: https://apps.apple.com/us/app/inspectpng/id498851708?mt=12
NOTE: I do not vouch for the safety of any of the above links. Please use standard caution when downloading any file from the internet. If you don't have your own anti-virus, Virustotal has one online you can upload individual files to for free.

Resources