mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-28 00:00:03 -04:00
#490: Refactorings, added initial detection of linked/unlinked segments, more tests.
This commit is contained in:
+2
-2
@@ -28,9 +28,9 @@ public final class AdobePathBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdobePathReader#path()
|
||||
* @see AdobePathReader#readPath()
|
||||
*/
|
||||
public Path2D path() throws IOException {
|
||||
return delegate.path();
|
||||
return delegate.readPath();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Harald Kuhr
|
||||
* Copyright (c) 2014-2020, Harald Kuhr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,7 +33,6 @@ package com.twelvemonkeys.imageio.path;
|
||||
import com.twelvemonkeys.imageio.stream.ByteArrayImageInputStream;
|
||||
|
||||
import javax.imageio.IIOException;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.io.DataInput;
|
||||
import java.io.EOFException;
|
||||
@@ -90,7 +89,7 @@ public final class AdobePathReader {
|
||||
* @throws javax.imageio.IIOException if the input contains a bad path data.
|
||||
* @throws IOException if a general I/O exception occurs during reading.
|
||||
*/
|
||||
public Path2D path() throws IOException {
|
||||
public Path2D readPath() throws IOException {
|
||||
List<List<AdobePathSegment>> subPaths = new ArrayList<>();
|
||||
List<AdobePathSegment> currentPath = null;
|
||||
int currentPathLength = 0;
|
||||
@@ -110,8 +109,8 @@ public final class AdobePathReader {
|
||||
subPaths.add(currentPath);
|
||||
}
|
||||
|
||||
currentPath = new ArrayList<>(segment.length);
|
||||
currentPathLength = segment.length;
|
||||
currentPath = new ArrayList<>(segment.lengthOrRule);
|
||||
currentPathLength = segment.lengthOrRule;
|
||||
}
|
||||
else if (segment.selector == AdobePathSegment.OPEN_SUBPATH_BEZIER_LINKED
|
||||
|| segment.selector == AdobePathSegment.OPEN_SUBPATH_BEZIER_UNLINKED
|
||||
@@ -149,8 +148,8 @@ public final class AdobePathReader {
|
||||
* closePath()
|
||||
*/
|
||||
private Path2D pathToShape(final List<List<AdobePathSegment>> paths) {
|
||||
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, paths.size());
|
||||
GeneralPath subpath = null;
|
||||
Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD, paths.size());
|
||||
Path2D subpath = null;
|
||||
|
||||
for (List<AdobePathSegment> points : paths) {
|
||||
int length = points.size();
|
||||
@@ -163,7 +162,7 @@ public final class AdobePathReader {
|
||||
switch (step) {
|
||||
// Begin
|
||||
case 0: {
|
||||
subpath = new GeneralPath(Path2D.WIND_EVEN_ODD, length);
|
||||
subpath = new Path2D.Float(Path2D.WIND_EVEN_ODD, length);
|
||||
subpath.moveTo(current.apx, current.apy);
|
||||
|
||||
if (length > 1) {
|
||||
@@ -222,14 +221,12 @@ public final class AdobePathReader {
|
||||
switch (selector) {
|
||||
case AdobePathSegment.INITIAL_FILL_RULE_RECORD:
|
||||
case AdobePathSegment.PATH_FILL_RULE_RECORD:
|
||||
// Spec says Fill rule is ignored by Photoshop
|
||||
data.skipBytes(24);
|
||||
return new AdobePathSegment(selector);
|
||||
// Spec says Fill rule is ignored by Photoshop, we'll read it anyway
|
||||
case AdobePathSegment.CLOSED_SUBPATH_LENGTH_RECORD:
|
||||
case AdobePathSegment.OPEN_SUBPATH_LENGTH_RECORD:
|
||||
int size = data.readUnsignedShort();
|
||||
int lengthOrRule = data.readUnsignedShort();
|
||||
data.skipBytes(22);
|
||||
return new AdobePathSegment(selector, size);
|
||||
return new AdobePathSegment(selector, lengthOrRule);
|
||||
default:
|
||||
return new AdobePathSegment(
|
||||
selector,
|
||||
|
||||
+16
-18
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Harald Kuhr
|
||||
* Copyright (c) 2014-2020, Harald Kuhr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -63,7 +63,7 @@ final class AdobePathSegment {
|
||||
};
|
||||
|
||||
final int selector;
|
||||
final int length;
|
||||
final int lengthOrRule;
|
||||
|
||||
// TODO: Consider keeping these in 8.24FP format
|
||||
// Control point preceding knot
|
||||
@@ -85,18 +85,14 @@ final class AdobePathSegment {
|
||||
this(selector, -1, cppy, cppx, apy, apx, cply, cplx);
|
||||
}
|
||||
|
||||
AdobePathSegment(int fillRuleSelector) {
|
||||
this(isTrue(fillRuleSelector == PATH_FILL_RULE_RECORD || fillRuleSelector == INITIAL_FILL_RULE_RECORD, fillRuleSelector, "Expected fill rule record (6 or 8): %s"),
|
||||
0, -1, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
AdobePathSegment(final int lengthSelector, final int length) {
|
||||
this(isTrue(lengthSelector == CLOSED_SUBPATH_LENGTH_RECORD || lengthSelector == OPEN_SUBPATH_LENGTH_RECORD, lengthSelector, "Expected path length record (0 or 3): %s"),
|
||||
length,
|
||||
AdobePathSegment(final int selector, final int lengthOrRule) {
|
||||
this(isTrue(selector == CLOSED_SUBPATH_LENGTH_RECORD || selector == OPEN_SUBPATH_LENGTH_RECORD
|
||||
|| selector == PATH_FILL_RULE_RECORD || selector == INITIAL_FILL_RULE_RECORD, selector, "Expected path length or fill rule record (0/3 or 6/8): %s"),
|
||||
lengthOrRule,
|
||||
-1, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
private AdobePathSegment(final int selector, final int length,
|
||||
private AdobePathSegment(final int selector, final int lengthOrRule,
|
||||
final double cppy, final double cppx,
|
||||
final double apy, final double apx,
|
||||
final double cply, final double cplx) {
|
||||
@@ -104,7 +100,7 @@ final class AdobePathSegment {
|
||||
switch (selector) {
|
||||
case CLOSED_SUBPATH_LENGTH_RECORD:
|
||||
case OPEN_SUBPATH_LENGTH_RECORD:
|
||||
isTrue(length >= 0, length, "Expected positive length: %d");
|
||||
isTrue(lengthOrRule >= 0, lengthOrRule, "Expected positive length: %d");
|
||||
break;
|
||||
case CLOSED_SUBPATH_BEZIER_LINKED:
|
||||
case CLOSED_SUBPATH_BEZIER_UNLINKED:
|
||||
@@ -116,15 +112,17 @@ final class AdobePathSegment {
|
||||
);
|
||||
break;
|
||||
case PATH_FILL_RULE_RECORD:
|
||||
case CLIPBOARD_RECORD:
|
||||
case INITIAL_FILL_RULE_RECORD:
|
||||
isTrue(lengthOrRule == 0 || lengthOrRule == 1, lengthOrRule, "Expected rule (1 or 0): %d");
|
||||
break;
|
||||
case CLIPBOARD_RECORD:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown selector: " + selector);
|
||||
}
|
||||
|
||||
this.selector = selector;
|
||||
this.length = length;
|
||||
this.lengthOrRule = lengthOrRule;
|
||||
this.cppy = cppy;
|
||||
this.cppx = cppx;
|
||||
this.apy = apy;
|
||||
@@ -152,7 +150,7 @@ final class AdobePathSegment {
|
||||
&& Double.compare(that.cppx, cppx) == 0
|
||||
&& Double.compare(that.cppy, cppy) == 0
|
||||
&& selector == that.selector
|
||||
&& length == that.length;
|
||||
&& lengthOrRule == that.lengthOrRule;
|
||||
|
||||
}
|
||||
|
||||
@@ -161,7 +159,7 @@ final class AdobePathSegment {
|
||||
long tempBits;
|
||||
|
||||
int result = selector;
|
||||
result = 31 * result + length;
|
||||
result = 31 * result + lengthOrRule;
|
||||
tempBits = Double.doubleToLongBits(cppy);
|
||||
result = 31 * result + (int) (tempBits ^ (tempBits >>> 32));
|
||||
tempBits = Double.doubleToLongBits(cppx);
|
||||
@@ -183,10 +181,10 @@ final class AdobePathSegment {
|
||||
switch (selector) {
|
||||
case INITIAL_FILL_RULE_RECORD:
|
||||
case PATH_FILL_RULE_RECORD:
|
||||
return String.format("Rule(selector=%s, rule=%d)", SELECTOR_NAMES[selector], length);
|
||||
return String.format("Rule(selector=%s, rule=%d)", SELECTOR_NAMES[selector], lengthOrRule);
|
||||
case CLOSED_SUBPATH_LENGTH_RECORD:
|
||||
case OPEN_SUBPATH_LENGTH_RECORD:
|
||||
return String.format("Len(selector=%s, length=%d)", SELECTOR_NAMES[selector], length);
|
||||
return String.format("Len(selector=%s, length=%d)", SELECTOR_NAMES[selector], lengthOrRule);
|
||||
default:
|
||||
// fall-through
|
||||
}
|
||||
|
||||
+89
-18
@@ -1,3 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Harald Kuhr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.twelvemonkeys.imageio.path;
|
||||
|
||||
import com.twelvemonkeys.imageio.metadata.psd.PSD;
|
||||
@@ -13,6 +43,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.twelvemonkeys.imageio.path.AdobePathReader.DEBUG;
|
||||
import static com.twelvemonkeys.imageio.path.AdobePathSegment.*;
|
||||
import static com.twelvemonkeys.lang.Validate.isTrue;
|
||||
import static com.twelvemonkeys.lang.Validate.notNull;
|
||||
@@ -27,10 +58,10 @@ public final class AdobePathWriter {
|
||||
/**
|
||||
* Creates an AdobePathWriter for the given path.
|
||||
* <p>
|
||||
* NOTE: Photoshop paths are stored with the coordinates
|
||||
* (0,0) representing the top left corner of the image,
|
||||
* and (1,1) representing the bottom right corner,
|
||||
* regardless of image dimensions.
|
||||
* NOTE: Photoshop paths are stored with the coordinates
|
||||
* (0,0) representing the top left corner of the image,
|
||||
* and (1,1) representing the bottom right corner,
|
||||
* regardless of image dimensions.
|
||||
* </p>
|
||||
*
|
||||
* @param path A {@code Path2D} instance that has {@link Path2D#WIND_EVEN_ODD WIND_EVEN_ODD} rule
|
||||
@@ -51,16 +82,24 @@ public final class AdobePathWriter {
|
||||
// TODO: Look at the API so that conversion both ways are aligned. The read part builds a path from List<List<AdobePathSegment>...
|
||||
private static List<AdobePathSegment> pathToSegments(final PathIterator pathIterator) {
|
||||
double[] coords = new double[6];
|
||||
AdobePathSegment prev = new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, 0, 0, 0,0, 0, 0);
|
||||
AdobePathSegment prev = new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
List<AdobePathSegment> subpath = new ArrayList<>();
|
||||
List<AdobePathSegment> segments = new ArrayList<>();
|
||||
segments.add(new AdobePathSegment(PATH_FILL_RULE_RECORD));
|
||||
segments.add(new AdobePathSegment(PATH_FILL_RULE_RECORD, 0));
|
||||
segments.add(new AdobePathSegment(INITIAL_FILL_RULE_RECORD, 0));
|
||||
|
||||
while (!pathIterator.isDone()) {
|
||||
int segmentType = pathIterator.currentSegment(coords);
|
||||
System.out.println("segmentType: " + segmentType);
|
||||
System.err.println("coords: " + Arrays.toString(coords));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("segmentType: " + segmentType);
|
||||
System.err.println("coords: " + Arrays.toString(coords));
|
||||
}
|
||||
|
||||
// TODO: We need to support unlinked segments!
|
||||
|
||||
boolean collinear;
|
||||
|
||||
switch (segmentType) {
|
||||
case PathIterator.SEG_MOVETO:
|
||||
@@ -71,17 +110,23 @@ public final class AdobePathWriter {
|
||||
break;
|
||||
|
||||
case PathIterator.SEG_LINETO:
|
||||
subpath.add(new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
collinear = isCollinearAndSameDistance(prev.cppx, prev.cppy, prev.apx, prev.apy, coords[0], coords[1]);
|
||||
System.out.println("isCollinear? " + collinear);
|
||||
subpath.add(new AdobePathSegment(collinear ? CLOSED_SUBPATH_BEZIER_LINKED : CLOSED_SUBPATH_BEZIER_UNLINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
prev = new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, coords[1], coords[0], coords[1], coords[0], 0, 0);
|
||||
break;
|
||||
|
||||
case PathIterator.SEG_QUADTO:
|
||||
subpath.add(new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
collinear = isCollinearAndSameDistance(prev.cppx, prev.cppy, prev.apx, prev.apy, coords[0], coords[1]);
|
||||
System.out.println("isCollinear? " + collinear);
|
||||
subpath.add(new AdobePathSegment(collinear ? CLOSED_SUBPATH_BEZIER_LINKED : CLOSED_SUBPATH_BEZIER_UNLINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
prev = new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, coords[3], coords[2], coords[3], coords[2], 0, 0);
|
||||
break;
|
||||
|
||||
case PathIterator.SEG_CUBICTO:
|
||||
subpath.add(new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
collinear = isCollinearAndSameDistance(prev.cppx, prev.cppy, prev.apx, prev.apy, coords[0], coords[1]);
|
||||
System.out.println("isCollinear? " + collinear);
|
||||
subpath.add(new AdobePathSegment(collinear ? CLOSED_SUBPATH_BEZIER_LINKED : CLOSED_SUBPATH_BEZIER_UNLINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, coords[1], coords[0]));
|
||||
prev = new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, coords[3], coords[2], coords[5], coords[4], 0, 0);
|
||||
break;
|
||||
|
||||
@@ -93,7 +138,10 @@ public final class AdobePathWriter {
|
||||
// subpath.add(new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, prev.cppy, prev.cppx, prev.apy, prev.apx, 0, 0));
|
||||
throw new AssertionError("Not a closed path");
|
||||
}
|
||||
subpath.set(0, new AdobePathSegment(CLOSED_SUBPATH_BEZIER_LINKED, prev.cppy, prev.cppx, initial.apy, initial.apx, initial.cply, initial.cplx));
|
||||
|
||||
collinear = isCollinearAndSameDistance(prev.cppx, prev.cppy, initial.apx, initial.apy, initial.cplx, initial.cply);
|
||||
System.out.println("isCollinear? " + collinear);
|
||||
subpath.set(0, new AdobePathSegment(collinear ? CLOSED_SUBPATH_BEZIER_LINKED : CLOSED_SUBPATH_BEZIER_UNLINKED, prev.cppy, prev.cppx, initial.apy, initial.apx, initial.cply, initial.cplx));
|
||||
|
||||
// Add to full path
|
||||
segments.add(new AdobePathSegment(CLOSED_SUBPATH_LENGTH_RECORD, subpath.size()));
|
||||
@@ -110,17 +158,38 @@ public final class AdobePathWriter {
|
||||
return segments;
|
||||
}
|
||||
|
||||
public void writePath(final DataOutput output) throws IOException {
|
||||
System.err.println("segments: " + segments.size());
|
||||
private static final double COLLINEARITY_THRESHOLD = 0.035;
|
||||
|
||||
private static boolean isCollinearAndSameDistance(double x1, double y1, double x2, double y2, double x3, double y3) {
|
||||
// return (y3 - y2) * (x2 - x1) == (y2 - y1) * (x3 - x2); // Collinear Slope
|
||||
// return x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) == 0; // Collinear (Double) Area
|
||||
|
||||
// return Math.abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) <= 0.0005; // With some slack...
|
||||
|
||||
// return Math.abs(Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)) - Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, 2))) <= 0.01;
|
||||
|
||||
// TODO: Get hold of a real Photoshop sample... The current data may be wrong.
|
||||
// TODO: If correct, PS writes linked if all points are the same...
|
||||
return (x1 == x2 && x2 == x3 && y1 == y2 && y2 == y3) ||
|
||||
(x1 != x2 || y1 != y2) && (x2 != x3 || y2 != y3) && Math.abs((x2 - x1) - (x3 - x2)) <= COLLINEARITY_THRESHOLD && Math.abs((y2 - y1) - (y3 - y2)) <= COLLINEARITY_THRESHOLD;
|
||||
}
|
||||
|
||||
void writePathResource(final DataOutput output) throws IOException {
|
||||
output.writeInt(PSD.RESOURCE_TYPE);
|
||||
output.writeShort(PSD.RES_CLIPPING_PATH);
|
||||
output.writeShort(0); // Path name (Pascal string) empty + pad
|
||||
output.writeInt(segments.size() * 26); // Resource size
|
||||
|
||||
writePath(output);
|
||||
}
|
||||
|
||||
public void writePath(final DataOutput output) throws IOException {
|
||||
if (DEBUG) {
|
||||
System.err.println("segments: " + segments.size());
|
||||
System.err.println(segments);
|
||||
}
|
||||
|
||||
for (AdobePathSegment segment : segments) {
|
||||
System.err.println(segment);
|
||||
switch (segment.selector) {
|
||||
case PATH_FILL_RULE_RECORD:
|
||||
case INITIAL_FILL_RULE_RECORD:
|
||||
@@ -132,7 +201,7 @@ public final class AdobePathWriter {
|
||||
case OPEN_SUBPATH_LENGTH_RECORD:
|
||||
case CLOSED_SUBPATH_LENGTH_RECORD:
|
||||
output.writeShort(segment.selector);
|
||||
output.writeShort(segment.length); // Subpath length
|
||||
output.writeShort(segment.lengthOrRule); // Subpath length
|
||||
output.write(new byte[22]);
|
||||
break;
|
||||
default:
|
||||
@@ -148,13 +217,15 @@ public final class AdobePathWriter {
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] createPath() {
|
||||
// TODO: Better name?
|
||||
public byte[] writePath() {
|
||||
// TODO: Do we need to care about endianness for TIFF files?
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
||||
try (DataOutputStream stream = new DataOutputStream(bytes)) {
|
||||
writePath(stream);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new AssertionError("Should never.. uh.. Oh well. It happened.", e);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,10 +163,10 @@ public final class Paths {
|
||||
System.out.println("resourceBlocks: " + resourceBlocks);
|
||||
}
|
||||
|
||||
Entry resourceBlock = resourceBlocks.getEntryById(PSD.RES_CLIPPING_PATH);
|
||||
Entry pathResource = resourceBlocks.getEntryById(PSD.RES_CLIPPING_PATH);
|
||||
|
||||
if (resourceBlock != null) {
|
||||
return new AdobePathReader((byte[]) resourceBlock.getValue()).path();
|
||||
if (pathResource != null) {
|
||||
return new AdobePathReader((byte[]) pathResource.getValue()).readPath();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -259,9 +259,7 @@ public final class Paths {
|
||||
BufferedImage destination;
|
||||
if (args.length == 1) {
|
||||
// Embedded path
|
||||
try (ImageInputStream input = ImageIO.createImageInputStream(new File(args[0]))) {
|
||||
destination = readClipped(input);
|
||||
}
|
||||
destination = readClipped(ImageIO.createImageInputStream(new File(args[0])));
|
||||
}
|
||||
else {
|
||||
// Separate path and image
|
||||
@@ -282,5 +280,4 @@ public final class Paths {
|
||||
System.err.printf("%s not deleted\n", tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user