8000 Support raw images · Issue #16 · karlch/vimiv-qt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support raw images #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
karlch opened this issue Jan 6, 2019 · 5 comments
Closed

Support raw images #16

karlch opened this issue Jan 6, 2019 · 5 comments
Labels
enhancement New feature or request help wanted

Comments

@karlch
Copy link
Owner
karlch commented Jan 6, 2019

There has been the request for supporting raw images, this should be rather simple according to
https://stackoverflow.com/questions/18637721/how-to-display-a-raw-image-file-in-a-qt-gui.

The file format would have to be detected by the load method in imutils/imfile_handler.py and a correct pixmap created from the data.

See this issue of the GTK version.

@karlch karlch added enhancement New feature or request good first issue Good for newcomers priority-low help wanted and removed priority-low good first issue Good for newcomers labels Jan 6, 2019
@karlch
Copy link
Owner Author
karlch commented Jan 13, 2019

This is actually more difficult than I thought, there seem to be a phletora of different formats and reading any of them directly requires knowing width and height of the image in advance. Possibly simply reading the embedded jpeg is a solution as mention in the issue linked before, but I can only find the small thumbnail version of this which is rather small for displaying. @tobiasbrummer or @ninrod, could you comment on what you mean with the embedded jpeg, is it really simply the thumbnail?

@t0bybr
Copy link
t0bybr commented Jan 21, 2019

I don’t know about all cameras as I only have access to my Sony A6300 at the moment. But I just tried to extract the embedded JPG image from a RAW file of the Sony A6300 with „dcraw -e“ and I get a JPG file with ~1600x1080px which I think is enough for preview purposes.

@karlch
Copy link
Owner Author
karlch commented Jan 22, 2019

Thanks, that was the hint I needed 😄

With a quick and dirty hack I can get this working. For future reference, something along the lines of

output = subprocess.run(["dcraw", "-e", "-c", path], capture_output=True, check=True)
pixmap = QPixmap()
pixmap.loadFromData(output.stdout)
...

There are more pythonic solutions, e.g. using wand, but these seem significantly slower as they actually process the complete raw file.

As, in any case, this adds an additional dependency I think this could be a great plugin after #13 is in. Writing the actual API is currently my focus, a raw plugin could then be the next step.

karlch added a commit that referenced this issue Dec 8, 2019
This plugin makese it easy to add new image formats without impacting
the performance of `utils.files.is_image` by adding very many formats by
default.

The plugin can be activated by adding `imageformats = name, ...` to the
plugins section of the configuration file. As a proof of concept, the
"cr2" format is added here.

To extend support for additional formats, we now only have to:

* Implement a imghdr like test function in imageformats.
* Add that function with the corresponding format name to the FORMATS
  dictionary.
* Activate it in the configuration file as described above.

This is related to supporting raw images (#16) as this is in principle
possible with qt raw, but we don't recognize the images in the correct
format as they are not part of imghdr.
@karlch
Copy link
Owner Author
karlch commented Dec 8, 2019

I have recently learned about qt raw plugin. In principle this would provide full support for raw images. Issue with this is that the check we use to determine if a file is an image (utils.files.is_image) relies on imghdr which has no idea about raw images.

In principle, it is not too difficult to extend imghdr with new formats but every additional check impacts performance. As a compromise, there is now the imageformats plugin added in a1b8f42. It currently only supports "cr2", as that was the easiest proof-of-concept for me to implement.

It would be great if we could extend plugins.imageformats as needed, any help is very welcome :)

@karlch
Copy link
Owner Author
karlch commented Nov 8, 2020

Solved via @jcjgraf's RawPrev plugin and, in principle, with qt raw. I don't think there is more we can or should do here.

@karlch karlch closed this as completed Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted
Projects
None yet
Development

No branches or pull requests

2 participants
0