Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
- Subject: Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 24 Aug 2016 19:33:27 +0200
> Le 24 août 2016 à 18:50, David Duncan <email@hidden> a écrit :
>
>
>> On Aug 24, 2016, at 1:23 AM, Jeff Szuhay <email@hidden> wrote:
>>
>> I’m using a bunch of layers to draw images to, compose them, and then draw into a viewRect
>> with
>>
>> CGContextDrawLayerInRect( viewContext, viewRect, myLayer);
>>
>> Of course, I’m trying to pick the most reasonable size for my layers. I currently use 1024x1024
>> but could easily make them 512x512 or 768x768.
>>
>> So my question is, “Is is more efficient to draw the layer into a smaller viewRect (down-sample)
>> or into a larger ViewRect (up-sample)?”
>>
>> Or does it even matter?
>
> It depends on if quality or performance matters more.
>
> Downsampling is generally more expensive because you have to deal with more data and so you become more easily bandwidth limited, but at the same time if you must resample an image, down sampling generally produces better quality. Upsampling is the opposite of all that.
>
> So if performance matters more than quality, then you probably want to upsample.
>
Moreover, the performance will greatly depends the sampling algorithm you choose. CGImage provide a couple of algorithms with different tradeoff (see CGContextSetInterpolationQuality() and NSImage and UIImage equivalents).
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden