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: add support for ARW, DNG, CR2 raw #140

Merged

Conversation

abidkhan484
Copy link
Contributor

@abidkhan484 abidkhan484 commented Oct 2, 2024

This pull request for the issue #15 will introduce:

  1. Support for RAW file processors.
  • ARW
  • DNG
    • yurij: doesn't actually work with DNG produced by Lightroom, disabled in this PR
  • CR2

The other raw format should work by adding the extension in the IMAGE_REGEX constant but the below formats are not yet tested.

  • CR3
  • CRW
  1. If a RAW file and a JPG file with the same name exist in the same directory, the logic will prioritize processing the JPG file and ignore the corresponding RAW file.

@abidkhan484
Copy link
Contributor Author

@yurijmikhalevich, could you please review the changes and suggest your valuable opinion?

@yurijmikhalevich yurijmikhalevich changed the title Support raw image format feat: add support for ARW, DNG, CR2 raw Oct 6, 2024
rclip/main.py Outdated Show resolved Hide resolved
Copy link
Owner

@yurijmikhalevich yurijmikhalevich Oct 6, 2024

Choose a reason for hiding this comment

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

This is an amazing start 🙌 Thank you. Can you please add a test or two that includes all of the newly added image formats?

When adding test images, can you please pick or create RAW files that weigh as little as possible to keep the repo size small?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have downloaded the raw images from internet that have relatively larger file sizes (about 10 to 40 MB). I also searched conversion tools and tried to convert using Python libraries. But it didn't work.

Adding these larger images could increase the tool size. What is your opinion regarding this sized image upload to the test folder? @yurijmikhalevich

Copy link
Owner

Choose a reason for hiding this comment

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

@abidkhan484, I think adding 3 10Mb images to the repository can be ok. We aren't bundling them in the distributions anyway.

But, if we can create 3 small 100px * 100px RAW images, it would be much better.

Also, when adding images, we should be mindful of their license. All of the images in the rclip test dir are the images I took myself 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yurijmikhalevich, I have tried to resize or convert images. But I failed. So, It's difficult for me to add different raw photos. But I can download some raw images from the internet those sizes on average 40MB. Need your suggestion badly.

Copy link
Owner

Choose a reason for hiding this comment

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

@abidkhan484, let me see what I can do.

Copy link
Owner

Choose a reason for hiding this comment

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

@abidkhan484, I am going to cleanup and merge your branch, and then will add tests in a separate PR.

I can't add it in this PR because GitHub and git-lfs don't let me push large images to your branch (-:

Copy link
Owner

Choose a reason for hiding this comment

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

@abidkhan484, another important thing to do in this PR was to ensure that the --preview works for the RAW images. Check out this diff for implementation: 46f2fc8.

image

Copy link
Owner

Choose a reason for hiding this comment

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

Hm. Also, it doesn't actually support "DNG" files created by Lightroom. This is why tests are important 💭

image

Copy link
Owner

Choose a reason for hiding this comment

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

@abidkhan484, merged! 🙌 Congrats with your first contribution to rclip and thank you for the help 🔥

pyproject.toml Outdated Show resolved Hide resolved
rclip/fs.py Outdated Show resolved Hide resolved
Copy link
Owner

@yurijmikhalevich yurijmikhalevich left a comment

Choose a reason for hiding this comment

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

Let's merge it. I am going to put the RAW support behind the command-line argument in a follow-up PR for until we can better test it.

Thank you for the help with this 🙌

@yurijmikhalevich yurijmikhalevich merged commit 15805ed into yurijmikhalevich:main Nov 3, 2024
16 checks passed
@yurijmikhalevich
Copy link
Owner

@all-contributors please add @abidkhan484 for code

Copy link
Contributor

@yurijmikhalevich

I've put up a pull request to add @abidkhan484! 🎉

yurijmikhalevich pushed a commit that referenced this pull request Nov 3, 2024
Adds @abidkhan484 as a contributor for code.

This was requested by yurijmikhalevich [in this
comment](#140 (comment))

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
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