xRyul / obsidian-image-converter

⚡️ Convert and compress images from one format to another by drag'n'dropping or pasting files into the note.
MIT License
111 stars 11 forks source link

[FR] Default maximum image size (non-destructive) #12

Open juanbretti opened 7 months ago

juanbretti commented 7 months ago

Hello, Great plugin. Thank you for refreshing the previous plugin by musug.

I would like to propose a feature, where the images have a maximum image size (horizontal) of X. In a non-destructive way.

My use case: I tend to copy and paste lots of images into my Obsidian. I don't want to reduce the size of the images. But I don't want the images to take all the note space.

My proposal: Instead of having to resize (non-destructive) each image individually, the plugin could check the image size and if it's bigger than X, apply an image size. Using ![[Pasted image 20230924161352.jpg|1000]] the |. Like "Image resize mode", but non-destructive.

Thank you for your consideration.

xRyul commented 7 months ago

hey, thanks for checking it out!

that's a great idea, going to try to push it out with the next update

juanbretti commented 7 months ago

Thank you @xRyul for implementing this FR. I think could be better if the "custom" setup value is a minimum size. Because as it is now, small images are expanded to match whatever I set as "custom" value.

I think this "Custom" should work like min(custom, actual.image.dimension). Where actual.image.dimension is checking -as you are doing now- the resizeMode.

xRyul commented 7 months ago

Hey, thanks for getting back to me 🙏

That's correct, currently it simply adds the desired size to the end of image link. So any too small images would get "upscaled", possibly useful for anyone who wants to have any of their images appear coherently throughout the note. Although, as you and suggest this is not great when pasting too small images. Especially considering that Obsidian doesn't resample low-res images when we use "| size". Without resampling - low-res images will look crap, as they are simply being stretched.

Nevertheless, this might simply need a toggle, to simply enable/disable small image upscale. I am planning to implement a few other options, hence why currently the option appears as a dropdown. Following are just a few options I was looking at:

juanbretti commented 7 months ago

Thank you for considering this idea. Regarding the proposed options, just a few considerations:

Custom limit (here is an input box):

Allow (dropdown):

Set limit based on (dropdown):

For sure this is too much optionality, but for you to consider and limit to what you consider reasonable and doable.