CamanJS icon indicating copy to clipboard operation
CamanJS copied to clipboard

Image does not draw to canvas (iOS retina devices) when pixel ratio != 1

Open preich1 opened this issue 11 years ago • 2 comments

I'm rendering an image from a url into a canvas using the following:

Caman('#photoCanvas', url, function() {});

This works on all browsers PC & Mac. However, on the iPad (gen 3 & 4) and iPhone (4S), the image fails to render into the canvas and the canvas remains blank.

I suspect the issue may be related to the hiDPI / pixel ratio code.

I was able to get the image to render into the canvas on the iOS retina devices by modifying the source code to force the pixel ratio to be 1.

Are you able to replicate this as well? I'm using version 4.11 of CamanJS. Thanks!

preich1 avatar Jul 10 '13 16:07 preich1

Same problem on new retina iMac. Is there anyone who fixed this in some way? Thank you

AndryBray avatar Jun 24 '16 10:06 AndryBray

@AndryBray I don't know if you fixed it. I found this in the guide.

CamanJS supports HiDPI displays (also known as Retina displays) as of version 4. 
Specifying HiDPI image replacements is done via the data-caman-hidpi HTML attribute.

<img
  src="/path/to/image.jpg"
  data-caman-hidpi="/path/to/[email protected]"
>

gabrielseco avatar Aug 17 '16 14:08 gabrielseco