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

Question: Discover Longest Image Size For Preprocessor #814

Open
rehatkathuria opened this issue Sep 14, 2024 · 1 comment
Open

Question: Discover Longest Image Size For Preprocessor #814

rehatkathuria opened this issue Sep 14, 2024 · 1 comment
Labels

Comments

@rehatkathuria
Copy link

Is it possible to determine whether an image's width or height is bigger? Or possible to write a processor? I'd like to be able to set a value to the longer edge, regardless of which it is

LazyImage(url: asset.url)
	.processors(
		[
			.resize(longerPlane: 99)
		]
	)
@kean kean added the question label Sep 15, 2024
@kean
Copy link
Owner

kean commented Sep 15, 2024

By default, the resize processors scales the image to fill the provided area. See https://kean-docs.github.io/nuke/documentation/nuke/imageprocessing/resize(size:unit:contentmode:crop:upscale:) for more info and see if that works for you.

Yes, it's fairly easy to write a custome image processor. Related guide: https://kean-docs.github.io/nuke/documentation/nuke/image-processing/. Alternatively, you can create one on the fly using a closure https://kean-docs.github.io/nuke/documentation/nuke/imageprocessing/process(id:_:).

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

No branches or pull requests

2 participants