Skip to content
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

feat: original-sized previews for RAW images #14446

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eligao
Copy link
Contributor

@eligao eligao commented Dec 2, 2024

  • Server: extract and keep the original-sized preview image
    • If image.extractEmbedded in options is set, it will attempt to extract the JPG/Preview from RAW images.
    • If the preview is too small or the extractEmbedded is not set, it will fall back to creating a full-sized image from RAW.
    • The result will be saved as a separate AssetFileType.converted file.
  • OpenAPI: a new AssetMediaSize.Original size is available under the viewThumbnail API
    • It returns the original-sized preview for RAW files
    • Or otherwise the original image itself.
  • Web: photo-viewer
    • When zoomed in, the browser loads the AssetMediaSize.Original preview via the viewThumbnail API
    • This applies to both RAW and non-RAW images, instead of previously only loading the original file for non-RAW image.
    • This file can be right-clicked and downloaded/copied for sharing.

Some loose ends:

  • The converted preview of RAW don't have original EXIF
    • Especially the color profile is missing, making the rendering a bit off other than sRGB images.
    • This would be a nice touch to help easier organize and share the compressed images from RAW.
    • And it can open up the possibilities to "trim" the RAW images and replace them with just the JPG with all EXIF, freeing the space on the server.
  • The way to download the file is implicit
    • A button, especially on the mobile app, would be helpful, but I'm not familiar with flutter.
  • The API endpoint to download the original preview and original file for non-RAW files are different, but the contents are identical, this is not good for caching, maybe better use 302 instead?

@eligao eligao changed the title feat/raw fullsize preview feat: original-sized previews for RAW images Dec 2, 2024
@eligao eligao force-pushed the feat/raw-fullsize-preview branch from f2b631a to 54b91b4 Compare December 2, 2024 16:35
Copy link
Contributor

@mertalev mertalev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I mostly looked at the server code, where I think it needs some more polishing.

Re: caching, this also affects the case where the user zooms in and no extracted image exists, right? It will load the preview again.

server/src/repositories/media.repository.ts Show resolved Hide resolved
server/src/repositories/media.repository.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
server/src/services/media.service.ts Outdated Show resolved Hide resolved
@eligao eligao force-pushed the feat/raw-fullsize-preview branch 5 times, most recently from 076d59d to a7a9b4d Compare December 3, 2024 21:24
@eligao eligao force-pushed the feat/raw-fullsize-preview branch from a7a9b4d to 34592b3 Compare December 3, 2024 21:29
@eligao
Copy link
Contributor Author

eligao commented Dec 6, 2024

any more comments from maintainers to get this merged, so that I can continue with previews of other images?
@danieldietzler @alextran1502

@alextran1502
Copy link
Contributor

@eligao no rush here

@mertalev
Copy link
Contributor

mertalev commented Dec 6, 2024

I think we should wait until we're done with hot fixes for the current release.

@michelheusschen
Copy link
Contributor

michelheusschen commented Dec 7, 2024

For a DNG image with a resolution of 5376x3956 and 41.3MiB in size, the following variants are generated using the default settings:

Variant Format Resolution Size
Thumbnail webp 5280x3956 887KiB
Preview jpeg 5280x3956 1794KiB
Original jpeg 5280x3956 1794KiB

These generated variants seem larger than expected and don't match the configured settings, with the preview and original being identical. It's also strange that the resolution has slightly changed.

@eligao
Copy link
Contributor Author

eligao commented Dec 7, 2024

For a DNG image with a resolution of 5376x3956 and 41.3MiB in size, the following variants are generated using the default settings:

Variant Format Resolution Size
Thumbnail webp 5280x3956 887KiB
Preview jpeg 5280x3956 1794KiB
Original jpeg 5280x3956 1794KiB
These generated variants seem larger than expected and don't match the configured settings, with the preview and original being identical. It's also strange that the resolution has slightly increased.

nice catch, the file sizes are indeed wrong, let me fix that and add checks to tests.
as for the sizes being slightly different, it's likely due to the crop tags in exif:
image

@mertalev
Copy link
Contributor

Hi again @eligao! We've been talking about the PR and think there are a few changes it'll need for it to be merge-able.

  1. It should apply to all images that aren't web compatible (using the same list as web, ignoring that Safari can view HEIF images)
  2. It should be configurable in the image settings, similar to the thumbnail and preview sections
    • There should be an "enabled" toggle that is disabled by default
    • The target format should be configurable in the case where an embedded image is not used and a new image has to be generated
  3. Rename the "converted" enum to "fullsize"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants