sketch-hq/sketch-assistant-core-rules

`images-no-outsized` flags a images exceeding the ratio even if the same image is used elsewhere conforming to the limit

christianklotz opened this issue · 3 comments

The same image can be used in multiple places, e.g. to fill an entire background and within a small button. While it may be way bigger than necessary for the button, as long as the image is below the ratio of the background size this represents no problem.

See reference document provided with https://github.com/sketch-hq/Sketch/issues/27973

@christianklotz can you please clarify this issue? i would expect each instance of an image that exceeds the ratio to be flagged, regardless of any other instances.

Yeah I had the same thought as @smithzoo ...

I think it depends what we view the purpose of the rule, is it:

  • To help limit Sketch file size? In which case the amendment suggested by @christianklotz makes sense. If an actual image asset (which is re-used throughout the document) is used properly in any position then it's "earned" its place in the document, as it were.
  • To enforce on a per usage basis that an image isn't oversized? Then the current behaviour makes sense. I'm wondering how we justify this behaviour though ... what about workflows that may export Sketch symbols to production assets? Would oversized images be a problem here? Not sure ...

They're two different use cases in my mind. Prevent the use of images exceeding the resolution required for any of its applications within the document to optimise file size feels useful and most automatable.

While I can see the value of enforcing on a per usage basis, I got the feeling this is more difficult to get right. While oversized or even just odd ratios of source image to output size can be a problem in some cases it is ultimately a creative decision. The most common scenario for this are probably icons which are typically vector based, meaning this rule doesn't apply here anyway.