Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:33:36+00:00 2026-06-06T17:33:36+00:00

Problem: I have a multipage TIFF image (generated with tiffutil) that contains the same

  • 0

Problem: I have a multipage TIFF image (generated with tiffutil) that contains the same image at multiple pixel dimension from 256×128 px all the way up to 4096×2048 px. I want to display this image in a CALayer so that the system automatically chooses the best representation of the image depending on the layer’s size. At the moment, the layer always uses the 256×128 representation of the image, regardless of its size.

Here’s what I do: I load the image with

NSImage *image = [NSImage imageNamed:@"map-multipage.tiff"];

Logging the image object confirms that it contains multiple representations with different pixel sizes, but all representations are the same size in points (256×128). AFAIK this is how Apple recommends multi-resolution images to be constructed.

NSLog(@"%@", image);

<NSImage 0x100623060 Name=map-multipage Size={256, 128} Reps=(
    "NSBitmapImageRep 0x10064d330 Size={256, 128} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=256x128 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x10014fdb0",
    "NSBitmapImageRep 0x10064e1b0 Size={256, 128} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=512x256 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x10014fdb0",
    ...
    "NSBitmapImageRep 0x100530bd0 Size={256, 128} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=4096x2048 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x10014fdb0"
)>

I then assign the NSImage instance directly to the layer’s contents property:

self.layerView.layer.contents = image;

As mentioned, the result is that the layer uses the first representation (256×128 px) to display the image, regardless of the layer’s size in points or pixels.

When I assign the same image to an NSImageView, it works as expected. The image view transparently selects the best image representation depending on its size. I would expect that CALayer would work the same way but apparently this is not the case. Can anybody confirm that CALayer does not support this automatic selection or am I doing something wrong?

(Note that this question is not directly related to HiDPI/Retina graphics. In fact, if I move the layer to a display in HiDPI mode, it does render a little sharper, indicating that it now uses the second bitmap representation (512×256 px) for rendering. This suggests that the automatism to select a higher resolution on a HiDPI display works while the fundamental selection of the best bitmap representation fails.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:33:38+00:00Added an answer on June 6, 2026 at 5:33 pm

    It seems like the AppKit method -[CALayer setContents:] chooses a bitmap representation of size matching -[contents size] if contents object is NSImage. Then the selected bitmap is used as is until -[CALayer setContents:] is called once again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem is this: I have multiple competing threads (100+) that need to access
Hi The problem am having is that I have multiple TreeView control and each
i have a problem calling multiple instance of a class that i have coded
Problem : I have multiple instances of the same C# application running on different
the problem i have is that i have multiple nested master pages: level 1
I have the problem that I will have multiple servers that perform jobs. They
My problem is I have a Java application that renders an image. Now I
I have a problem with a c++ socket. I'm using CAsyncSocket from MFC that
The problem. I have multiple tab, their content is loaded via ajax, so the
I am trying to solve the following problem with Puppet: I have multiple nodes.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.