I have a complex problem I can figure out. A little history... I used to use Bit.ly to generate qr codes. They went down so I went to google for reliability.
Im using Quark to do stuff with the codes but I need to configure them prior to them going to quark. With Bitly, the qr codes were generated percfecty. However when Google generates them, they are in RGB where bitly generated in grayscale which was perfect. I am using perl's ImageMagick library to make the necessary edit on the image prior to downloading them.
So far this is what I have.. Google generates a link for a qr code which I download. Because it is in RGB, I need grayscale or bitmap so it will be compatible with quark (effectively).
sub ConvertToGrayscale {
my ($imagePath) = @_;
my $OutPath = $imagePath; # $OutPath =~ s/png$/jpg/i;
my $image = Image::Magick->new() or die 'Unable to create new Image Object.';
my $imageReadError = '';
my $imageWriteError = '';
$imageReadError = $image->Read($imagePath); # returns a code if there is an error
if ($imageReadError) {
warn "Error: $imageReadError. Unable to read image path: $imagePath";
} else {
# $image->Scale(geometry => '75');
# $image->Set('png:color-type' => 'Grayscale', 'png:bit-depth' => '8');
# $image->Set(colorspace => 'Gray', magick => 'JPEG', quality => '100');
$imageWriteError = $image->Write($OutPath);
}
if ($imageWriteError) { warn "Error: $imageWriteError. Unable to write image file: $OutPath"; }
}
Now the complex issue is when I simply use the Set function to set some properties on the image such as colorspace => grayscale, it converts the images mode to grayscale, but when I load it into quark it is huge and I am unable to shrink it small enough to use. So a good candidate for this solution is someone who may have experience with both software.
On a side note that may be helpful. If i load the image into photoshop, I can convert the image made to grayscale there and everything is perfect. So it seems like I would want my perl script to mock what photoshop does to the image.