How to view images in own directories? - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

How to view images in own directories?

  • 8 Replies
  • 1469 Views
How to view images in own directories?
« on: 25 / May / 2021, 15:14:32 »
Advertisements
Hello,
I have a few hundert images on my memory card so I would like to move them in different directories so I can find specific images faster. I can create new directories and move images but as soon as I move them, they are not displayed anymore.

Does someone know how to select a specific directory to view the images inside?
« Last Edit: 03 / June / 2021, 17:44:47 by Joker135 »

*

Offline reyalp

  • ******
  • 13392
Re: How to view images in own directories?
« Reply #1 on: 25 / May / 2021, 17:01:06 »
Hello,
I have a few hundert images on my memory card so I would like to move them in different directories so I can find specific images faster. I can create new directories and move images but as soon as I move them, they are not displayed anymore.

Does someone know how to select a specific directory to view the images inside?
AFAIK, there is no way to do this with the Canon firmware. The camera only pays attention to images in the DCIM/... directories that match the camera naming convention, and it generally shows all of them.

Some cameras do have other options to organize images, like "group" "favorites" or "albums". These vary by model and will be described in the Canon manual.

Investigation of the "group" feature found on some cams was reported in  https://chdk.setepontos.com/index.php?topic=14206.0
If your camera supports this, you could theoretically group images that weren't already grouped by editing the exif.
Don't forget what the H stands for.

Re: How to view images in own directories?
« Reply #2 on: 25 / May / 2021, 17:46:11 »
The camera only pays attention to images in the DCIM/... directories that match the camera naming convention, and it generally shows all of them.
Ah, so that's how you change the directory. By having only 1 directory with a valid name at any given time. To change it, I need to rename the old valid directory to an invalid name and change the new (still invalid) directory name to an valid one. Then I need to be able to create a or edit a textfile to store the directory name before I rename it to something valid, so I can change it back later, when I select a different directory to show.

Thank you.

Is this possible?
- renaming a directory
- reading a directory name
- writing a text file
- reading a text file

*

Offline reyalp

  • ******
  • 13392
Re: How to view images in own directories?
« Reply #3 on: 25 / May / 2021, 18:00:39 »
Is this possible?
- renaming a directory
Probably not one that contains files. Last time I tested, attempting to rename non-empty directories failed or cause filesystem corruption. However, that was many years ago, it's possible modern cameras behave differently.

Note also that you cannot *move* files between directories, you must copy and delete.

If you're feeling adventurous, you could potentially implement move/rename at the FAT level, but you'd likely need to update whatever filesystem information the Canon OS keeps in memory in addition to modifying the filesystem on disk.

Quote
- reading a directory name
- writing a text file
- reading a text file
All of those are possible using Lua  https://chdk.fandom.com/wiki/Lua#Lua_standard_libraries:_io.2C_os.2C_string.2C_and_math

You might be able to rename files *within* a directory to a name that isn't recognized by the Canon OS. Like IMG_nnnn.JPG to nnnn_IMG.JPG. However, the camera caches file information in some way, so the renamed files would likely still show up in the browser with a "missing file" icon until you restarted.
Don't forget what the H stands for.


Re: How to view images in own directories?
« Reply #4 on: 27 / May / 2021, 14:29:31 »
Is this possible?
- renaming a directory
Probably not one that contains files. Last time I tested, attempting to rename non-empty directories failed or cause filesystem corruption. However, that was many years ago, it's possible modern cameras behave differently.

Well, the camera that I have is also several years old. But the file browser somehow manages to rename directories. :-/

*

Offline Caefix

  • *****
  • 602
  • Sorry, busy deleting test shots...
Re: How to view images in own directories?
« Reply #5 on: 27 / May / 2021, 14:45:31 »
Is this possible?
... sometimes in <play>, within the limits of naming conventions : review(folder-_filename.jpg) ?   :-*
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 13392
Re: How to view images in own directories?
« Reply #6 on: 27 / May / 2021, 15:33:15 »
Well, the camera that I have is also several years old. But the file browser somehow manages to rename directories. :-/
Which camera do you have? If it works, this would be useful information for others. FWIW, I think investigated this ~10 years ago, so "modern" is relative ;)

Also, just FWIW, I wouldn't assume the CHDK file browser allowing you to rename means it's safe. At the least, I would very much suggest making sure anything you care about on the card is backed up before experimenting.
Don't forget what the H stands for.

Re: How to view images in own directories?
« Reply #7 on: 03 / June / 2021, 10:08:03 »
Ok, I think I found a working solution.

Firstly, my camera is a SX 710 HS.

os.rename seems to work, but sometimes it changes the directory name into all uppercase for what reason ever.

To set up the camera for the script to work you need to rename all your 000xxxxx-directories to something without 3 decimal places at the beginning. For example rename "101__012" to "SUNSETS" and rename "102__001" to "CARS". Use only uppercase letters from A to Z or 0 to 9. No Ä or something untested. Do not use subdirectories. All directories must be directly in the "DCIM"-directory. Subdirectories are not tested.

When you start your camera it will tell you that you have no images (because they are all in directories with invalid names). Run the script and select an image in the directory you want to see. Then shut off your camera and then turn in back on again. Then you only see the images of the selected directory. The directory is now renamed to "100_SHOW".

If you run the script again to select a different directory then the directory "100_SHOW" will be renamed to it's original name (for example "SUNSETS") before the next selected directory is renamed to "100_SHOW".

The directory "100_SHOW" will contain a file called "OLDNAM.TXT". The script uses it to store the original directory name in it. This text file will be deleted after the script read the content.

To close a directory without opening the next one just run the script and select the directory "100_SHOW". The script will notice that it can't find the selected directory after it renamed "100_SHOW" to it's original name and stop execution at exactly the right time. So there will be no "100_SHOW" directory anymore meaning the directory is closed and the camera will tell you that there are no images to show.

The script is in the attachment.

Btw: If you shoot a photo then the camera will create a new directory with a valid name. So you will see your shot photo(s) and the photos from your selected directory. So you need to manually move your newly shot photos or rename the newly created directory.

Oh, and something else: If you have 2 directories with names both starting with "100..." then the images of none of those 2 directories will be shown. So one directory needs to be named "100..." and the other "101...".
« Last Edit: 03 / June / 2021, 11:20:44 by Joker135 »


Re: How to view images in own directories?
« Reply #8 on: 03 / June / 2021, 16:56:02 »
If anyone cares, here is a new version which has less restrictions: Subdirectories are now supported. And the image directories (for example "SUNSETS" and "CARS") do not have to be in the "DCIM"-directory anymore. Actually, if os.rename works correctly, then they don't even have to be on the same disk anymore. But beware of the datatransfer if you open or close a directory on an external usb drive or so.

Also a success message has been added for opening and closing a directory. All messages are german and translation is your own duty.
« Last Edit: 03 / June / 2021, 17:01:30 by Joker135 »

 

Related Topics