marcisme / sketch-preview

Sketch plugin to preview mockups in Skala Preview
MIT License
610 stars 37 forks source link

Bitmap Exporting and Importing compatibility with macOS High Sierra #46

Closed richardsison closed 6 years ago

richardsison commented 6 years ago

Since Sketch 49 (up until 49.2), there's been an odd colour conversion issue. This is what would happen: https://d.pr/i/Mwigd

Last night, Sketch updated to 49.3 and fixed this bug.

Unfortunately, the issue still occurs with Skala Preview. See example: https://d.pr/i/icetna

When I drag images directly onto Skala it's correct, but when the Sketch Preview pushes the artboard to Skala Preview, the colours are still incorrect.

Have you run into this? …Hopefully this makes sense…!

marcisme commented 6 years ago

@richardsison Thanks for reporting this. I can reproduce it, and I'm currently investigating.

marcisme commented 6 years ago

@richardsison I think this has something to do with the color profile. If I change the document color profile to P3, then the exported images look correct when exported to Skala Preview. Prior to changing anything, the test document I'm using was "Unmanaged".

I'm using an older export mechanism in the plugin, which seems to not embed a color profile. There seems to be a newer mechanism used by the official Javascript API for Sketch that does embed a profile, but I still can't get the colors right without changing the document to P3.

This is going to require some additional research.

marcisme commented 6 years ago

Note that drag and dropping an dartboard to Skala Preview looks correct in all cases, but I've yet to figure out how to analyze the drag and drop data to see what exactly it contains.

richardsison commented 6 years ago

You sir are a legend. Thanks so much for getting back to me!

Unfortunately not even changing to P3 fixes it for me. The colours are all over the place. Only manually dragging an artboard works.

Fingers crossed! Hope this gets fixed soon. Thanks mate!

This plugin has been such a solid little plugin for ages. I've been using the Sketch Preview > Skala Preview > Skala View combo for mirroring for years. It's always been more reliable than Sketch's built-in solution. This has been the only time I've had an issue!

Sketch 49 has also introduced some bug which affects auto-updating plugins. Seems to happen when I open a second Sketch file (i.e. library or just new file) the auto-update required for Sketch Preview (and the Paddy plugin) stops working. It requires a Sketch restart to fix it.

Anyway, keep up the awesome work!

marcisme commented 6 years ago

@richardsison I'm sorry to hear P3 didn't work for you. I'm not sure how realistic of a workaround that would be for most people anyways. I'm still looking into this.

Regarding the auto update, that may be related to one of the settings the plugin uses to stay in memory. At some point in the past there was a leak issue with too many versions of the plugin getting loaded, which that setting fixed. I may be able to remove that now, but I consider it a much lower priority issue in comparison to this color one.

rusik commented 6 years ago

Also found this issue :(

mjboswell commented 6 years ago

Hi Marc – was curious if any progress was being made here. I've resorting to using Sketch Mirror in the meantime and it's killing me!

marcisme commented 6 years ago

@Rusik @mjboswell I'm sorry this is affecting both of you.

I think this may be a bug with how NSImage renders images it determines to be sRGB. I might have a workaround, but I'm still assessing its impacts and how feasible it will be to do through Cocoascript.

marcisme commented 6 years ago

I may have actually just found a simple fix. The current problem is related to the PNG format, and I think exporting as TIFF may be an option.

marcisme commented 6 years ago

@Rusik @mjboswell @richardsison I still need to do some testing, but this may work for you for now.

cd /tmp
git clone https://github.com/marcisme/sketch-preview.git
cd sketch-preview/
git checkout color-fix
open SketchPreview.sketchplugin

Then restart Sketch.

If you try the above, let me know if it works for you.

mjboswell commented 6 years ago

@marcisme – You sir are a gentleman and a scholar!

richardsison commented 6 years ago

@marcisme Dammit… Still not working for me. Updated Sketch Preview as per above, checked colour settings that they're on P3 (also tried sRGB again…) but still getting same issue: https://d.pr/i/0alh5F

marcisme commented 6 years ago

@richardsison I'm sorry this still isn't working.

Can you try unchecking "Save for web" in the export dialog? It seems that when not specified, programatic exports use the most recently used option from there.

If it still doesn't look correct, can you open the file at /Users/<your username>/Library/Caches/com.marcisme.sketch-preview/preview.tiff in Preview.app, then hit ⌘I and check the value of "ColorSync Profile"?

The intent of this change is for the file to be a .tiff and the value in that field to be sRGB IEC61966-2.1. (If you're intentionally working in Display P3, it would have that, which I think should be ok too.)

richardsison commented 6 years ago

@marcisme !!! Unchecking "Save for Web" worked!

Thank you so much for getting onto that so promptly… Now I can get back to work properly haha

You are a legend.

Cheers, Rich

marcisme commented 6 years ago

@richardsison Awesome! I'll update the plugin to set that option to false, so it won't be affected by the current default.

Thank you for helping figure this out.

richardsison commented 6 years ago

No problem at all. It was all you!

Cheers, Rich

marcisme commented 6 years ago

This should be fixed in v0.13.0, released now.

Thanks again for the reports.

mjboswell commented 6 years ago

Awesome work, @marcisme! Is there anything I need to run in Terminal now, or will the update just overwrite the temporary fix you had me do?

marcisme commented 6 years ago

@mjboswell Thanks! Sketch should notice the plugin has a new version available eventually, and it should overwrite the temporary version when you update.