Skip to content

Edit screenshots to reduce file size #1102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

skirtles-code
Copy link
Contributor

@skirtles-code skirtles-code commented Jun 22, 2021

This PR reduces the size of 5 images that show screenshots of code in an editor. They're shown across 2 pages:

These are some of the largest images in the docs. They're now reduced to about 15-20% of their original file size:

  • breakpoint_hit.png: 610KB -> 98KB, 16%
  • breakpoint_set.png: 536KB -> 79KB, 15%
  • config_add.png: 518KB -> 75KB, 15%
  • sfc-with-preprocessors.png: 160KB -> 32KB, 20%
  • sfc.png: 111KB -> 21KB, 19%

For the cookbook page this is a reduction of about 1.4MB.

I used GIMP to reduce the file size. The process was:

  1. Crop the image to remove the transparent margin. This also removed the drop shadow.
  2. Fill in the rounded corners to remove any remaining transparency.
  3. Convert the image to an indexed palette, with 255 colours.
  4. Export the image with all meta data removed and compression turned up to full.

I then reapplied the rounded corners and drop shadow using CSS. It won't be a perfect match for what was there before but I think I got it pretty close.

I haven't resized the images (aside from the cropping). That could have reduced the file size further but I didn't think it was worth it. I would assume that having relatively large images helps to keep them rendering clearly at different sizes and resolutions.

Changing to 255 colours could, in theory, impact the quality of the image. In practice, they look the same to me. The original images are still in the Git history should we ever need them.

I applied the CSS using style attributes. That seemed to be how custom styles were applied elsewhere, though I'd usually use class instead. I suppose that might be to ensure that the styles aren't lost by theme updates?

@skirtles-code skirtles-code marked this pull request as ready for review June 22, 2021 12:01
@NataliaTepluhina NataliaTepluhina merged commit a39b783 into vuejs:master Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants