Squeeze now recompresses old compression methods
This commit is contained in:
parent
6408bd8879
commit
81409cfcaf
2
Changes
2
Changes
|
@ -28,6 +28,7 @@ o More PNGs - greyscale 1, 2, 4, 8, 16bpp and RGB 16bpp
|
||||||
o -pages -fast to print number of pages from /Count
|
o -pages -fast to print number of pages from /Count
|
||||||
o Report number of annotations in -page-info
|
o Report number of annotations in -page-info
|
||||||
o Specify image based only on file extension
|
o Specify image based only on file extension
|
||||||
|
o -squeeze updates old compression methods
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
|
|
||||||
|
@ -36,7 +37,6 @@ o Fixed -set-annotations with page links
|
||||||
o Allow Exif JPEGs as well as JFIF ones in -jpeg and -draw-jpeg
|
o Allow Exif JPEGs as well as JFIF ones in -jpeg and -draw-jpeg
|
||||||
o Only compress a stream if it actually makes it smaller
|
o Only compress a stream if it actually makes it smaller
|
||||||
|
|
||||||
|
|
||||||
2.6.1 (September 2023)
|
2.6.1 (September 2023)
|
||||||
|
|
||||||
o Fixed regression in UTF8 text with -add-text
|
o Fixed regression in UTF8 text with -add-text
|
||||||
|
|
|
@ -13,14 +13,19 @@ let report_pdf_size pdf =
|
||||||
|
|
||||||
(* Recompress anything which isn't compressed, unless it's metadata. *)
|
(* Recompress anything which isn't compressed, unless it's metadata. *)
|
||||||
let recompress_stream pdf = function
|
let recompress_stream pdf = function
|
||||||
(* If there is no compression, compress with /FlateDecode *)
|
(* If there is no compression, or bad compression with /FlateDecode *)
|
||||||
| Pdf.Stream {contents = (dict, _)} as stream ->
|
| Pdf.Stream {contents = (dict, _)} as stream ->
|
||||||
begin match
|
begin match
|
||||||
Pdf.lookup_direct pdf "/Filter" dict,
|
Pdf.lookup_direct pdf "/Filter" dict,
|
||||||
Pdf.lookup_direct pdf "/Type" dict
|
Pdf.lookup_direct pdf "/Type" dict
|
||||||
with
|
with
|
||||||
| _, Some (Pdf.Name "/Metadata") -> ()
|
| _, Some (Pdf.Name "/Metadata") -> ()
|
||||||
| (None | Some (Pdf.Array [])), _ ->
|
| ( None
|
||||||
|
| Some (Pdf.Name ("/ASCIIHexDecode" | "/ASCII85Decode" | "/LZWDecode" | "/RunLengthDecode"))
|
||||||
|
| Some (Pdf.Array []
|
||||||
|
| Pdf.Array (Pdf.Name ("/ASCIIHexDecode" | "/ASCII85Decode" | "/LZWDecode" | "/RunLengthDecode")::_)
|
||||||
|
)), _ ->
|
||||||
|
Pdfcodec.decode_pdfstream_until_unknown pdf stream;
|
||||||
Pdfcodec.encode_pdfstream ~only_if_smaller:true pdf Pdfcodec.Flate stream
|
Pdfcodec.encode_pdfstream ~only_if_smaller:true pdf Pdfcodec.Flate stream
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue