Nuke icon indicating copy to clipboard operation
Nuke copied to clipboard

Question: Discover Longest Image Size For Preprocessor

Open rehatkathuria opened this issue 1 year ago • 1 comments

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)
		]
	)

rehatkathuria avatar Sep 14 '24 23:09 rehatkathuria

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:_:).

kean avatar Sep 15 '24 18:09 kean