|
|
|
@ -36,16 +36,12 @@ module LoadBmp
|
|
|
|
|
|
|
|
|
|
|
|
image_rgb =
|
|
|
|
image_rgb =
|
|
|
|
if bands == 3
|
|
|
|
if bands == 3
|
|
|
|
Vips::Image.bandjoin([image[2], image[1], image[0]])
|
|
|
|
image.recomb(band3_recomb)
|
|
|
|
elsif bands == 4
|
|
|
|
elsif bands == 4
|
|
|
|
Vips::Image.bandjoin([image[2], image[1], image[0], image[3]])
|
|
|
|
image.recomb(band4_recomb)
|
|
|
|
else
|
|
|
|
|
|
|
|
image
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if image_rgb.interpretation == :multiband || image_rgb.interpretation == :'b-w'
|
|
|
|
image_rgb = image_rgb.copy(interpretation: :srgb) if image_rgb.interpretation != :srgb
|
|
|
|
image_rgb = image_rgb.copy(interpretation: :srgb)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_rgb
|
|
|
|
image_rgb
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@ -166,5 +162,26 @@ module LoadBmp
|
|
|
|
|
|
|
|
|
|
|
|
unpadded_rows.join
|
|
|
|
unpadded_rows.join
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def band3_recomb
|
|
|
|
|
|
|
|
@band3_recomb ||=
|
|
|
|
|
|
|
|
Vips::Image.new_from_array(
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
[0, 0, 1],
|
|
|
|
|
|
|
|
[0, 1, 0],
|
|
|
|
|
|
|
|
[1, 0, 0]
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def band4_recomb
|
|
|
|
|
|
|
|
@band4_recomb ||= Vips::Image.new_from_array(
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
[0, 0, 1, 0],
|
|
|
|
|
|
|
|
[0, 1, 0, 0],
|
|
|
|
|
|
|
|
[1, 0, 0, 0]
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
# rubocop:enable Metrics
|
|
|
|
# rubocop:enable Metrics
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|