use new_from_memory_copy
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ module LoadBmp
|
|||||||
bands = header_data[:bpp] / 8
|
bands = header_data[:bpp] / 8
|
||||||
end
|
end
|
||||||
|
|
||||||
image = Vips::Image.new_from_memory(final_pixel_data, header_data[:width], header_data[:height], bands, :uchar)
|
image = Vips::Image.new_from_memory_copy(final_pixel_data, header_data[:width], header_data[:height], bands, :uchar)
|
||||||
|
|
||||||
image = image.flip(:vertical) if header_data[:orientation] == -1
|
image = image.flip(:vertical) if header_data[:orientation] == -1
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -202,13 +202,13 @@ module LoadIco
|
|||||||
|
|
||||||
return nil unless pixel_data_string.bytesize == expected_bytes && expected_bytes.positive?
|
return nil unless pixel_data_string.bytesize == expected_bytes && expected_bytes.positive?
|
||||||
|
|
||||||
Vips::Image.new_from_memory(
|
Vips::Image.new_from_memory_copy(
|
||||||
pixel_data_string,
|
pixel_data_string,
|
||||||
dib_width,
|
dib_width,
|
||||||
image_pixel_height,
|
image_pixel_height,
|
||||||
4,
|
4,
|
||||||
:uchar
|
:uchar
|
||||||
)
|
).copy(interpretation: :srgb)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
# rubocop:enable Metrics
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ module Templates
|
|||||||
|
|
||||||
data, width, height = page.render_to_bitmap(size_key => size)
|
data, width, height = page.render_to_bitmap(size_key => size)
|
||||||
|
|
||||||
Vips::Image.new_from_memory(data, width, height, 4, :uchar)
|
Vips::Image.new_from_memory_copy(data, width, height, 4, :uchar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_fields(fields, y_threshold: 0.01)
|
def sort_fields(fields, y_threshold: 0.01)
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ module Templates
|
|||||||
|
|
||||||
bytes, width, height = doc_page.render_to_bitmap(width: MAX_WIDTH)
|
bytes, width, height = doc_page.render_to_bitmap(width: MAX_WIDTH)
|
||||||
|
|
||||||
image = Vips::Image.new_from_memory(bytes, width, height, 4, :uchar)
|
image = Vips::Image.new_from_memory_copy(bytes, width, height, 4, :uchar)
|
||||||
|
|
||||||
Concurrent::Promise.execute(executor: pool) { build_and_upload_blob(image, page_number) }
|
Concurrent::Promise.execute(executor: pool) { build_and_upload_blob(image, page_number) }
|
||||||
ensure
|
ensure
|
||||||
@@ -201,7 +201,7 @@ module Templates
|
|||||||
|
|
||||||
doc_page.close
|
doc_page.close
|
||||||
|
|
||||||
image = Vips::Image.new_from_memory(bytes, width, height, 4, :uchar)
|
image = Vips::Image.new_from_memory_copy(bytes, width, height, 4, :uchar)
|
||||||
|
|
||||||
blob = build_and_upload_blob(image, page_number, PREVIEW_FORMAT)
|
blob = build_and_upload_blob(image, page_number, PREVIEW_FORMAT)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user