Re: Scaling a UIImage

2020-11-04 Thread Alex Zavatone via Cocoa-dev
I’ve got more if you need to desaturate an image, remove all color, tint a bitmap, as opposed to using tint, this actually makes a new tinted bitmap, find imageInbundle, create enabled and disabled images from source images and so on. Sometimes we want to use the actual tint, and other times, if

Re: Scaling a UIImage

2020-11-04 Thread Carl Hoefs via Cocoa-dev
Thanks for the UIImage category resizing methods! They are quite useful. -Carl > On Nov 4, 2020, at 2:17 PM, Alex Zavatone wrote: > > Sorry for the delay. I hope these do what you need. > Of course you’ll need to add checks to make sure that you’re not dividing by > zero or nil. > > > > //

Re: Scaling a UIImage

2020-11-04 Thread Alex Zavatone via Cocoa-dev
Sorry for the delay. I hope these do what you need. Of course you’ll need to add checks to make sure that you’re not dividing by zero or nil. // Alex Zavatone 4/2/16. + (UIImage *)imageWithImage:(UIImage *)image scaledToHeight:(CGFloat)newHeight { CGFloat ratio = newHeight / image.siz

Re: Scaling a UIImage

2020-11-03 Thread James Crate via Cocoa-dev
On Nov 2, 2020, at 5:59 PM, Carl Hoefs via Cocoa-dev wrote: > I have an iOS app that interacts with a macOS server process. The iOS app > takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a JPEG > representation of it to send to the server: I have code that does pretty mu

Re: Scaling a UIImage

2020-11-02 Thread Alex Zavatone via Cocoa-dev
I’lll dig up a utility class that I made for UIImage that has this as well as others. Cheers. > On Nov 2, 2020, at 4:59 PM, Carl Hoefs via Cocoa-dev > wrote: > > How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels? > > > I have an iOS app that interacts with a macOS se

Re: Scaling a UIImage

2020-11-02 Thread David Duncan via Cocoa-dev
> On Nov 2, 2020, at 3:20 PM, Carl Hoefs wrote: > > Okay. It was my understanding that -TIFFRepresentation was the only way to > get serializable image data bytes... What is a more efficient way to do this? If you want serializable data bytes, sure, but thats not what you appear to be doing

Re: Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
Okay. It was my understanding that -TIFFRepresentation was the only way to get serializable image data bytes... What is a more efficient way to do this? -Carl > On Nov 2, 2020, at 3:09 PM, David Duncan wrote: > > Also any code using -TIFFRepresentation for any reason other than to get > actua

Re: Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
Yes! That's what I overlooked. "native" isn't what I intended. Thanks! -Carl > On Nov 2, 2020, at 3:09 PM, David Duncan wrote: > >> UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0); > > Explicitly pass 1 here. > > ___ Cocoa-dev mailing

Re: Scaling a UIImage

2020-11-02 Thread David Duncan via Cocoa-dev
> On Nov 2, 2020, at 2:59 PM, Carl Hoefs via Cocoa-dev > wrote: > > How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels? > > > I have an iOS app that interacts with a macOS server process. The iOS app > takes a 3264x2448 camera image, scales it to 640x480 pixels, and m

Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels? I have an iOS app that interacts with a macOS server process. The iOS app takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a JPEG representation of it to send to the server: NSData *dataObj = UII