Archive for March 4, 2020

Wednesday, March 4, 2020

Optimizing PDF File Size

Patrik Weiskircher:

However, [incremental saving] also causes the file size to grow and grow and never get smaller. This is especially noticeable if you work with a lot of images. And even if you remove an image, it still is included in the PDF; you only instruct your PDF viewer to not show it again.

[…]

Another nice feature of PDFs is that objects like fonts and images can be shared across pages — a feature that was specifically made in an effort to save on the size of files. This means you can have an image logo on each page and it is only included in the PDF file once.

[…]

So right before we start saving the document, we go through the entire PDF file and collect a list of all the reachable object numbers. Then, when saving the PDF, but before we write out an indirect object, we compare its objects number with the list we collected, and if the object isn’t included, we simply don’t write it out.

I can’t tell from this whether they coalesce duplicate objects or only garbage collect unreferenced ones.

Wide Gamut Color in CSS With Display-P3

Nikita Vasilyev (Hacker News):

WebKit is the only browser engine that supports Display-P3 color as of January 2020.

[…]

One way to provide a fallback is to include the same property with the sRGB color before:

header {
    color: rgb(0, 255, 0);
    color: color(display-p3 0 1 0);
}

Browsers other than WebKit currently parse color(…) as invalid value. CSS properties with invalid values are ignored by the browsers.

Alternatively, you can use @supports feature query.

Apple’s (Not Quite) Secure Notes

Sarah Edwards:

However, the ZSNIPPET column show the partial unencrypted content of this note. This is where potentially sensitive information from the note could be extracted. While I cannot see the full contents of the secure note, I can see the snippet or the first line of the note! I am unable see “The ocean is wet.” in this field.

[…]

I mentioned previously about the ZMARKEDFORDELETION column. When do these entries get deleted? Turns out, a few different ways!

  • Upon exiting Notes on macOS
  • Upon closing the Notes window on macOS
  • Upon swiping up (to go to the home screen) on iOS. Switching to another app does not necessarily delete the entries.

[…]

Due to the nature of how Apple Secure Notes work, it is possible for forensic analysts to acquire information, even if it is currently encrypted.

Besides this, it’s not clear to me that the old unencrypted data will actually be wiped from the SQLite database page when the row is logically deleted. And even then it may persist on disk, in previous blocks for both the database and for Spotlight. All of these problems stem from converting an unencrypted note to be encrypted. It’s better to start out with an empty encrypted note and then add content to it.

In EagleFiler I try to avoid this by encrypting the entire library from the start. The files and database, as well as search indexes, temporary files, Spotlight, and the versions database are only ever written in encrypted form.

Previously: