mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
You can now dump the black point for URLs to the pwd.
git-svn-id: https://zxing.googlecode.com/svn/trunk@954 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0a4e715ae4
commit
70eab118c1
|
@ -170,7 +170,6 @@ public final class CommandLineRunner {
|
|||
// Writes out a single PNG which is three times the width of the input image, containing from left
|
||||
// to right: the original image, the row sampling monochrome version, and the 2D sampling
|
||||
// monochrome version.
|
||||
// TODO: Currently fails on URLs. Would be nice to handle gracefully and write the output to pwd.
|
||||
private static void dumpBlackPoint(URI uri, BufferedImage image, MonochromeBitmapSource source) {
|
||||
String inputName = uri.getPath();
|
||||
if (inputName.contains(".mono.png")) {
|
||||
|
@ -235,7 +234,14 @@ public final class CommandLineRunner {
|
|||
BufferedImage result = new BufferedImage(stride, height, BufferedImage.TYPE_INT_ARGB);
|
||||
result.setRGB(0, 0, stride, height, pixels, 0, stride);
|
||||
|
||||
// Use the current working directory for URLs
|
||||
String resultName = inputName;
|
||||
if (uri.getScheme().equals("http")) {
|
||||
int pos = resultName.lastIndexOf('/');
|
||||
if (pos > 0) {
|
||||
resultName = "." + resultName.substring(pos);
|
||||
}
|
||||
}
|
||||
int pos = resultName.lastIndexOf('.');
|
||||
if (pos > 0) {
|
||||
resultName = resultName.substring(0, pos);
|
||||
|
|
Loading…
Reference in a new issue