johanclaesson / picpocket

Image viewer for Emacs
GNU General Public License v3.0
18 stars 2 forks source link

Raw support #4

Open feklee opened 1 year ago

feklee commented 1 year ago

For years, I've been using Emacs as an image viewer, but only yesterday I discovered picpocket, which is a big upgrade from plain image-mode. Now I wonder how to add support for viewing the preview JPEGs embedded in raw images. These can be easily extracted:

dcraw -e <raw_file>

One hacky way may be to enable image-use-external-converter, then write a wrapper around ImageMagick or GraphicsMagick. The wrapper would delegate conversion of raw images to dcraw.

Would that work? Are there better methods?

johanclaesson commented 1 year ago

Hi Felix,

Do i understand correctly that you want to make picpocket optionally display the embedded preview JPEG instead of the entire raw image? There should then be some command to toggle between displaying the entire images and the preview images. And the reason to view the preview images would be speed.

I guess this dcraw (which i was not aware about) maybe could also be used to speed up the generation of the thumbnails in the list that is displayed when 'l n' is pressed in picpocket.

To use image-use-external-converter i guess would work with image-mode but it would not work with picpocket. Before thinking about how to do it in picpocket i want to make sure i understand what you are looking for.

feklee commented 1 year ago

Hi Johan, thanks for looking into that!

Indeed, the idea is to get a quick preview based on the embedded JPEG. I am still trying to understand how the whole imaging system works in Emacs. See my thread Displaying images in the help-gnu-emacs mailing list. Interestingly, GraphicsMagick does support ARW files, but it is a bit slow at handling them. I may ask on the GraphicsMagick mailing list how to make it use the embedded JPEGs instead of apparently somehow interpretting the raw data. There is a system called delegates that may come to the rescue.

That being said, I’m not sure whether picpocket, like image-mode, does revert to image-converter for image files that Emacs does not support out of the box.

Greetz from Uppsala!