[Solved] Automate Graphic File Viewing

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mikeflan
Level 17
Level 17
Posts: 7106
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

[Solved] Automate Graphic File Viewing

Post by mikeflan »

I want to view the lower right corner of hundreds of TIF files so I can read them and then close them.
If you get this file:
http://www.mflan.com/temp/map.tif
and point a terminal at the location that that file resides, and then type

Code: Select all

display map.tif
ImageMagic will open the file enlarged on the screen. Then I can click in the lower right corner of the little thunbnail image in the center to view the lower right corner.

That is not too bad, but I have thousands of these files that I want to view. So I am trying to find a better way to view the extreme lower right corner of thousands of TIF files. Maybe even take a screenshot of that part of the TIF file. Anybody have an idea of how to do this more efficiently?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
absque fenestris
Level 12
Level 12
Posts: 4110
Joined: Sat Nov 12, 2016 8:42 pm
Location: Confoederatio Helvetica

Re: Automate Graphic File Viewing

Post by absque fenestris »

I've looked at your downloaded map with different viewers - if you want to take a snapshot of the text in the lower right corner at the same time, it's reasonably fast with Gwenview: open the map in "Fill" mode, click on the navigation window, open Crop and limit the frame to the lower corner and click "Save Crop As...".

ImageMagick appears in wonderful native resolution - from 3cm distance I can even read the menu text... :mrgreen:
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Automate Graphic File Viewing

Post by Flemur »

mikeflan wrote: Tue Sep 21, 2021 5:39 pmo I am trying to find a better way to view the extreme lower right corner of thousands of TIF files.
Check out "feh" and its option:

Code: Select all

--keep-zoom-vp
When switching images, keep zoom and viewport settings (zoom level and X, Y offsets) 
...although that might not work if your images are different sizes - but there might be params to take of that, too!

https://linux.die.net/man/1/feh
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
mikeflan
Level 17
Level 17
Posts: 7106
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Automate Graphic File Viewing

Post by mikeflan »

Thanks so much for the replies guys. I will definitely look into feh. It looks like that would work well for me.

If I do

Code: Select all

identify -format '%[EXIF:*]' 'Wright City.tif'
I get no significant output, so I guess there is no EXIF data in the document.

If I do

Code: Select all

identify -verbose 'Wright City.tif'
I get a bunch of data, including these 2 lines:

Code: Select all

 Properties:
    comment: USGS GeoTIFF DRG 1:24000 Quad of Wright City. Product:478096
I'm thinking that 478096 product number can be turned into the date on the map (1972). I am working on that right now.
mikeflan
Level 17
Level 17
Posts: 7106
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Automate Graphic File Viewing

Post by mikeflan »

Thanks so much Flemur. I am still working on the feh option.

Wow, people have exerted a lot of effort on image manipulation programs, but few do the seemingly simple thing I want. Zoom into a particular part of the picture and take a screenshot of that area. Sounds simple, doesn't it? I did not find any programs that can do it entirely from the terminal. Feh is probably the closest, but I am going to have to issue xdotool keystrokes to make it work. That doesn't sound right to me, but that is the way I am headed.

It just sounds so easy to supply an image file and a certain area of pixels to display, but I couldn't do it via the terminal. Surely Gimp can do it via their GUI.

It's possible Python Image Processing (listed below) can do this, but I need to research that further.


Anyway, I did a lot of research, so I guess I'll post some of that here for others:

Just a few Image Processing Options:

Feh - sure sounds like feh could do what I want, but it didn't work for me.
https://man.finalrewind.org/1/feh/

People having problems zooming with feh:
https://askubuntu.com/questions/1352729 ... fullscreen

Gimp Batch Mode:
https://www.gimp.org/tutorials/Basic_Batch/

GMIC (related to Gimp):
https://www.maketecheasier.com/advanced ... -and-gmic/

Python Image Processing - This has potential:
https://likegeeks.com/python-image-proc ... p_an_Image

fbi:
http://www.nongnu.org/fbi-improved/

PixInsight - This is a commercial product that sounds difficult:
https://pixinsight.com/resources/

There are plenty of others, but none I could find that would simply do what I want from the terminal.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Automate Graphic File Viewing

Post by Flemur »

mikeflan wrote: Thu Sep 23, 2021 9:09 pmThere are plenty of others, but none I could find that would simply do what I want from the terminal.
If you rotate the images 180 degrees, the lower-right becomes the upper-left, which should be (a lot!) easier to zoom into; if you're reading the map names/info, as in your example file, the rotation might not matter much. ristretto image viewer has a friendly and useful, but not expansive, interface, might be worth looking at.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
mikeflan
Level 17
Level 17
Posts: 7106
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Automate Graphic File Viewing

Post by mikeflan »

Well, the answer was very simple in the end. I was already looking at cropping, but did not find the answer until this morning. This will crop the map.tif from the link above:

Code: Select all

convert map.tif -crop 800x500+4140+6380 map1.tif
You can do:

Code: Select all

identify map.tif
to help determine the 800x500+4140+6380 figures to use in the command.

Thanks for all your help. Solved!
Locked

Return to “Software & Applications”