Skip to content

feat(arw): Adding automatic conversion for Sony ARW Camera formats#13

Open
luisgreen wants to merge 2 commits into
trougnouf:masterfrom
luisgreen:master
Open

feat(arw): Adding automatic conversion for Sony ARW Camera formats#13
luisgreen wants to merge 2 commits into
trougnouf:masterfrom
luisgreen:master

Conversation

@luisgreen

Copy link
Copy Markdown

Automatic Sony ARW raw file conversion & metadata printing

Summary

Adds automatic detection, metadata extraction, and conversion of Sony ARW (.ARW) raw camera files to 16-bit TIFF before denoising. Users can now point denoise_image.py directly at ARW files without manual preprocessing.

  • Detection: The function convert_arw_if_needed() checks the input path's extension (case-insensitive .ARW)
  • Metadata: On ARW detection, prints camera make/model (via exiftool), resolution (from rawpy), ISO, shutter speed, aperture, and focal length (via rawpy.RawPy.other)
  • Conversion: Uses rawpy.postprocess(use_camera_wb=True, output_bps=16) to produce a 16-bit RGB array, then writes it as TIFF via OpenCV
  • Temp file: Created via tempfile.mkstemp() in the same directory as the ARW file; cleaned up in a finally block after processing
  • Transparency: Non-ARW inputs (TIFF, JPEG, PNG) pass through unchanged; output naming uses the original ARW filename, not the temp filename
  • Error handling: Graceful exit with instructions if rawpy is not installed; error message on corrupt files
  • Example output
Detected ARW raw file: DSC02375.ARW
  Camera: SONY ILCE-7RM3
  Resolution: 7968 x 5320
  ISO: 6400.0
  Shutter: 1/500 s
  Aperture: f/4.0
  Focal length: 200 mm
  Converted to temporary TIFF: /path/to/tmpXXXX.tiff

@luisgreen

Copy link
Copy Markdown
Author

BTW... Came here just by chance... and ended up being exactly what I needed. Thanks for your efforts!

@trougnouf

Copy link
Copy Markdown
Owner

Thanks for the PR :-)

I'm not sure this is the best use-case :s Did you try https://github.com/trougnouf/rawnind_jddc ? It's made specifically for raw images, it denoises the raw files and outputs a virtually raw tiff file (linear RGB with just the demosaic applied) that can be developed in any way (e.g. with darktable), and it should provide better denoising performance.

If rawnind-denoise is not the experience you are looking for and you truly benefit more from this use case (getting a ready-to-publish denoised jpeg from a raw file) then we can merge this (although there is no reason to limit it to Sony ARW files since libraw/RawPy handles any/most raw image formats seamlessly), otherwise I would rather point users in the direction of RawNIND.

@luisgreen

Copy link
Copy Markdown
Author

Thanks for the PR :-)

I'm not sure this is the best use-case :s Did you try https://github.com/trougnouf/rawnind_jddc ? It's made specifically for raw images, it denoises the raw files and outputs a virtually raw tiff file (linear RGB with just the demosaic applied) that can be developed in any way (e.g. with darktable), and it should provide better denoising performance.

If rawnind-denoise is not the experience you are looking for and you truly benefit more from this use case (getting a ready-to-publish denoised jpeg from a raw file) then we can merge this (although there is no reason to limit it to Sony ARW files since libraw/RawPy handles any/most raw image formats seamlessly), otherwise I would rather point users in the direction of RawNIND.

Thank you for your response. let me take a look at it!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants