mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-07-23 09:24:39 -04:00
Merge branch 'master' of https://github.com/yacy/yacy_search_server
This commit is contained in:
htroot
source/net/yacy/document
test
@ -106,7 +106,6 @@ public class ViewImage {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// get the image as stream
|
||||
if (MemoryControl.shortStatus()) {
|
||||
iconcache.clear();
|
||||
@ -131,7 +130,9 @@ public class ViewImage {
|
||||
if (resourceb == null) {
|
||||
if (urlString.endsWith(".ico")) {
|
||||
// load default favicon dfltfvcn.ico
|
||||
// Should not do this here : we can be displaying search image result of '.ico' type and do not want to display a default
|
||||
// Should not do this here : we can be displaying search
|
||||
// image result of '.ico' type and do not want to display a
|
||||
// default
|
||||
if (defaulticonb == null)
|
||||
try {
|
||||
resourceb = FileUtils.read(new File(sb.getAppPath(), defaulticon));
|
||||
@ -148,50 +149,70 @@ public class ViewImage {
|
||||
}
|
||||
}
|
||||
|
||||
// gif images are not loaded because of an animated gif bug within
|
||||
// jvm which sends java into an endless loop with high CPU
|
||||
if (ext.equals("gif") && "gif".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) {
|
||||
return new ByteArrayInputStream(resourceb);
|
||||
} else if (ext.equals("svg") && "svg".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) {
|
||||
// svg images not supported by awt, but by most browser, deliver
|
||||
// just content (without crop/scale)
|
||||
String urlExt = MultiProtocolURL.getFileExtension(url.getFileName());
|
||||
if (ext != null && ext.equalsIgnoreCase(urlExt) && isBrowserRendered(urlExt)) {
|
||||
return new ByteArrayInputStream(resourceb);
|
||||
}
|
||||
|
||||
// read image
|
||||
encodedImage = parseAndScale(post, auth, urlString, ext, okToCache, resourceb);
|
||||
encodedImage = parseAndScale(post, auth, urlString, ext, okToCache, resourceb);
|
||||
}
|
||||
|
||||
return encodedImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process resourceb byte array to try to produce an Image instance eventually scaled and cropped depending on post parameters
|
||||
* @param post request post parameters. Must not be null.
|
||||
* @param auth true when access rigths are OK.
|
||||
* @param urlString image source URL. Must not be null.
|
||||
* @param ext image file extension. May be null.
|
||||
* @param okToCache true when image can be cached
|
||||
* @param resourceb byte array. Must not be null.
|
||||
* @param formatName
|
||||
* informal file format name. For example : "png".
|
||||
* @return true when image format is rendered by browser and not by
|
||||
* ViewImage internals
|
||||
*/
|
||||
public static boolean isBrowserRendered(String formatName) {
|
||||
/*
|
||||
* gif images are not loaded because of an animated gif bug within jvm
|
||||
* which sends java into an endless loop with high CPU
|
||||
*/
|
||||
/*
|
||||
* svg images not supported by jdk, but by most browser, deliver just
|
||||
* content (without crop/scale)
|
||||
*/
|
||||
return ("gif".equalsIgnoreCase(formatName) || "svg".equalsIgnoreCase(formatName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process resourceb byte array to try to produce an Image instance
|
||||
* eventually scaled and cropped depending on post parameters
|
||||
*
|
||||
* @param post
|
||||
* request post parameters. Must not be null.
|
||||
* @param auth
|
||||
* true when access rigths are OK.
|
||||
* @param urlString
|
||||
* image source URL. Must not be null.
|
||||
* @param ext
|
||||
* image file extension. May be null.
|
||||
* @param okToCache
|
||||
* true when image can be cached
|
||||
* @param resourceb
|
||||
* byte array. Must not be null.
|
||||
* @return an Image instance when parsing is OK, or null.
|
||||
*/
|
||||
protected static EncodedImage parseAndScale(serverObjects post, boolean auth, String urlString, String ext, boolean okToCache, byte[] resourceb) {
|
||||
protected static EncodedImage parseAndScale(serverObjects post, boolean auth, String urlString, String ext,
|
||||
boolean okToCache, byte[] resourceb) {
|
||||
EncodedImage encodedImage = null;
|
||||
|
||||
|
||||
Image image = ImageParser.parse(urlString, resourceb);
|
||||
|
||||
if (image != null) {
|
||||
int width = post.getInt("width", 0);
|
||||
int height = post.getInt("height", 0);
|
||||
int maxwidth = post.getInt("maxwidth", 0);
|
||||
int maxheight = post.getInt("maxheight", 0);
|
||||
final boolean quadratic = post.containsKey("quadratic");
|
||||
boolean isStatic = post.getBoolean("isStatic");
|
||||
if (!auth || (width != 0 && height != 0) || maxwidth != 0 || maxheight != 0) {
|
||||
if (!auth || maxwidth != 0 || maxheight != 0) {
|
||||
|
||||
// find original size
|
||||
final int h = image.getHeight(null);
|
||||
final int w = image.getWidth(null);
|
||||
int h = image.getHeight(null);
|
||||
int w = image.getWidth(null);
|
||||
|
||||
// in case of not-authorized access shrink the image to
|
||||
// prevent
|
||||
@ -203,9 +224,11 @@ public class ViewImage {
|
||||
// quadratic shape
|
||||
if (quadratic && w != h) {
|
||||
image = makeSquare(image, h, w);
|
||||
h = image.getHeight(null);
|
||||
w = image.getWidth(null);
|
||||
}
|
||||
|
||||
Dimension finalDimensions = calculateDimensions(w, h, width, height, maxDimensions);
|
||||
Dimension finalDimensions = calculateDimensions(w, h, maxDimensions);
|
||||
|
||||
if (w != finalDimensions.width && h != finalDimensions.height) {
|
||||
image = scale(finalDimensions.width, finalDimensions.height, image);
|
||||
@ -230,10 +253,9 @@ public class ViewImage {
|
||||
*
|
||||
* @return dimensions to render image
|
||||
*/
|
||||
protected static Dimension calculateDimensions(final int originWidth, final int originHeight, final int targetWidth,
|
||||
final int targetHeight, final Dimension max) {
|
||||
int resultWidth = targetWidth;
|
||||
int resultHeight = targetHeight;
|
||||
protected static Dimension calculateDimensions(final int originWidth, final int originHeight, final Dimension max) {
|
||||
int resultWidth;
|
||||
int resultHeight;
|
||||
if (max.width < originWidth || max.height < originHeight) {
|
||||
// scale image
|
||||
final double hs = (originWidth <= max.width) ? 1.0 : ((double) max.width) / ((double) originWidth);
|
||||
@ -321,7 +343,7 @@ public class ViewImage {
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Crop image to make a square
|
||||
*
|
||||
@ -335,13 +357,15 @@ public class ViewImage {
|
||||
if (w > h) {
|
||||
final BufferedImage dst = new BufferedImage(h, h, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g = dst.createGraphics();
|
||||
g.drawImage(image, 0, 0, h - 1, h - 1, (w - h) / 2, 0, h + (w - h) / 2, h - 1, null);
|
||||
final int offset = (w - h) / 2;
|
||||
g.drawImage(image, 0, 0, h - 1, h - 1, offset, 0, h + offset, h - 1, null);
|
||||
g.dispose();
|
||||
image = dst;
|
||||
} else {
|
||||
final BufferedImage dst = new BufferedImage(w, w, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g = dst.createGraphics();
|
||||
g.drawImage(image, 0, 0, w - 1, w - 1, 0, (h - w) / 2, w - 1, w + (h - w) / 2, null);
|
||||
final int offset = (h - w) / 2;
|
||||
g.drawImage(image, 0, 0, w - 1, w - 1, 0, offset, w - 1, w + offset, null);
|
||||
g.dispose();
|
||||
image = dst;
|
||||
}
|
||||
|
2
htroot/env/base.css
vendored
2
htroot/env/base.css
vendored
@ -260,6 +260,8 @@ tt, *.tt {
|
||||
width: 128px;
|
||||
height: 128px; /* 96px thumbnail + some lines of text */
|
||||
float: left;
|
||||
/* Cut non square images not rendered by YaCy ViewImage */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hides .hoverShow {
|
||||
|
@ -1089,7 +1089,21 @@ imageCreate : function() {
|
||||
this.content = img;
|
||||
img.onload = function () {
|
||||
if (hs.expanders[exp.key]) exp.contentLoaded();
|
||||
};
|
||||
/* Patch start : manage loading or rendering error to avoid 'loading...' stay indefinitely */
|
||||
img.onerror = function () {
|
||||
/* Set alternative text */
|
||||
img.alt = 'X';
|
||||
/* Set image size to ensure it can be clicked to close popup */
|
||||
if(exp.content) {
|
||||
exp.content.width = 30;
|
||||
exp.content.height = 30;
|
||||
}
|
||||
if (hs.expanders[exp.key]) {
|
||||
exp.contentLoaded();
|
||||
}
|
||||
};
|
||||
/* Patch end */
|
||||
if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
|
||||
img.className = 'highslide-image';
|
||||
hs.setStyles(img, {
|
||||
@ -1099,7 +1113,7 @@ imageCreate : function() {
|
||||
maxWidth: '9999px',
|
||||
zIndex: 3
|
||||
});
|
||||
img.title = hs.lang.restoreTitle;
|
||||
img.title = hs.lang.restoreTitle;
|
||||
if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
|
||||
if (hs.ie && hs.flushImgSize) img.src = null;
|
||||
img.src = this.src;
|
||||
|
@ -40,14 +40,10 @@
|
||||
</div>
|
||||
::
|
||||
#(item)#::<div class="thumbcontainer">
|
||||
<a href="#[href]#" target="#[target]#" class="thumblink" onclick="return hs.expand(this)">
|
||||
<!-- <img src="ViewImage.png?maxwidth=128&maxheight=128&code=#[code]#&isStatic=true" alt="#[name]#" /> -->
|
||||
<img src="#[hrefCache]#" width="128" height="128" alt="#[name]#" />
|
||||
<a href="#[hrefFullPreview]#" target="#[target]#" class="thumblink" onclick="return hs.expand(this)">
|
||||
<img src="#[hrefCache]#" width="#[width]#" height="#[height]#" style="#[style]#" alt="#[name]#" />
|
||||
</a>
|
||||
<div class="highslide-caption"><a href="#[href]#" target="#[target]#">#[name]#</a><br /><a href="#[source]#" target="#[target]#">#[sourcedom]#</a></div>
|
||||
<!--
|
||||
<div class="TableCellDark"><a href="#[href]#">#[name]#</a><br />#[attr]#</div>
|
||||
-->
|
||||
</div>#(/item)#
|
||||
::
|
||||
#(item)#::<tr class="#(col)#TableCellLight::TableCellDark#(/col)#"><td>#[name]#</td><td><a href="#[href]#" target="#[target]#">#[hrefshort]#</a></tr>#(/item)#
|
||||
|
@ -73,6 +73,10 @@ public class yacysearchitem {
|
||||
private static final int SHORTEN_SUFFIX_LENGTH = SHORTEN_SUFFIX.length();
|
||||
private static final int MAX_NAME_LENGTH = 60;
|
||||
private static final int MAX_URL_LENGTH = 120;
|
||||
/** Default image item width in pixels */
|
||||
private static final int DEFAULT_IMG_WIDTH = 128;
|
||||
/** Default image item height in pixels */
|
||||
private static final int DEFAULT_IMG_HEIGHT = DEFAULT_IMG_WIDTH;
|
||||
|
||||
//private static boolean col = true;
|
||||
|
||||
@ -81,7 +85,7 @@ public class yacysearchitem {
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
final String eventID = post.get("eventID", "");
|
||||
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
|
||||
final boolean authenticated = sb.verifyAuthentication(header);
|
||||
final int item = post.getInt("item", -1);
|
||||
final RequestHeader.FileType fileType = header.fileType();
|
||||
|
||||
@ -306,35 +310,7 @@ public class yacysearchitem {
|
||||
|
||||
if (theSearch.query.contentdom == Classification.ContentDomain.IMAGE) {
|
||||
// image search; shows thumbnails
|
||||
|
||||
prop.put("content", theSearch.query.contentdom.getCode() + 1); // switch on specific content
|
||||
try {
|
||||
SearchEvent.ImageResult image = theSearch.oneImageResult(item, timeout);
|
||||
final String imageUrlstring = image.imageUrl.toNormalform(true);
|
||||
final String imageUrlExt = MultiProtocolURL.getFileExtension(image.imageUrl.getFileName());
|
||||
final String target = sb.getConfig(imageUrlstring.matches(target_special_pattern) ? SwitchboardConstants.SEARCH_TARGET_SPECIAL : SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
|
||||
|
||||
final String license = URLLicense.aquireLicense(image.imageUrl); // this is just the license key to get the image forwarded through the YaCy thumbnail viewer, not an actual lawful license
|
||||
//sb.loader.loadIfNotExistBackground(image.imageUrl, 1024 * 1024 * 10, null, ClientIdentification.yacyIntranetCrawlerAgent);
|
||||
prop.putHTML("content_item_hrefCache", "ViewImage." + (!imageUrlExt.isEmpty() && "gif.png.svg".contains(imageUrlExt) ? imageUrlExt : "png") + "?maxwidth=128&maxheight=128&code="+license+"&isStatic=true&quadratic=&url=" + imageUrlstring);
|
||||
prop.putHTML("content_item_href", imageUrlstring);
|
||||
prop.putHTML("content_item_target", target);
|
||||
prop.put("content_item_code", license);
|
||||
prop.putHTML("content_item_name", shorten(image.imagetext, MAX_NAME_LENGTH));
|
||||
prop.put("content_item_mimetype", image.mimetype);
|
||||
prop.put("content_item_fileSize", 0);
|
||||
prop.put("content_item_width", image.width);
|
||||
prop.put("content_item_height", image.height);
|
||||
prop.put("content_item_attr", ""/*(ms.attr.equals("-1 x -1")) ? "" : "(" + ms.attr + ")"*/); // attributes, here: original size of image
|
||||
prop.put("content_item_urlhash", ASCII.String(image.imageUrl.hash()));
|
||||
prop.put("content_item_source", image.sourceUrl.toNormalform(true));
|
||||
prop.putXML("content_item_source-xml", image.sourceUrl.toNormalform(true));
|
||||
prop.put("content_item_sourcedom", image.sourceUrl.getHost());
|
||||
prop.put("content_item_nl", (item == theSearch.query.offset) ? 0 : 1);
|
||||
prop.put("content_item", 1);
|
||||
} catch (MalformedURLException e) {
|
||||
prop.put("content_item", "0");
|
||||
}
|
||||
processImage(sb, prop, item, theSearch, target_special_pattern, timeout);
|
||||
theSearch.query.transmitcount = item + 1;
|
||||
return prop;
|
||||
}
|
||||
@ -366,6 +342,79 @@ public class yacysearchitem {
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process search of image type and feed prop object. All parameters must not be null.
|
||||
* @param sb Switchboard instance
|
||||
* @param prop result
|
||||
* @param item item index.
|
||||
* @param theSearch search event
|
||||
* @param target_special_pattern
|
||||
* @param timeout result getting timeOut
|
||||
*/
|
||||
private static void processImage(final Switchboard sb, final serverObjects prop, final int item,
|
||||
final SearchEvent theSearch, final String target_special_pattern, long timeout) {
|
||||
prop.put("content", theSearch.query.contentdom.getCode() + 1); // switch on specific content
|
||||
try {
|
||||
SearchEvent.ImageResult image = theSearch.oneImageResult(item, timeout);
|
||||
final String imageUrlstring = image.imageUrl.toNormalform(true);
|
||||
final String imageUrlExt = MultiProtocolURL.getFileExtension(image.imageUrl.getFileName());
|
||||
final String target = sb.getConfig(imageUrlstring.matches(target_special_pattern) ? SwitchboardConstants.SEARCH_TARGET_SPECIAL : SwitchboardConstants.SEARCH_TARGET_DEFAULT, "_self");
|
||||
|
||||
final String license = URLLicense.aquireLicense(image.imageUrl); // this is just the license key to get the image forwarded through the YaCy thumbnail viewer, not an actual lawful license
|
||||
/* Image format ouput for ViewImage servlet : default is png, except with gif and svg images */
|
||||
final String viewImageExt = !imageUrlExt.isEmpty() && ViewImage.isBrowserRendered(imageUrlExt) ? imageUrlExt : "png";
|
||||
/* Thumb URL */
|
||||
prop.putHTML("content_item_hrefCache", "ViewImage." + viewImageExt + "?maxwidth=" + DEFAULT_IMG_WIDTH + "&maxheight=" + DEFAULT_IMG_HEIGHT + "&code="+license+"&isStatic=true&quadratic=&url=" + imageUrlstring);
|
||||
/* Full size preview URL */
|
||||
prop.putHTML("content_item_hrefFullPreview", "ViewImage." + viewImageExt + "?code="+license+"&isStatic=true&url=" + imageUrlstring);
|
||||
prop.putHTML("content_item_href", imageUrlstring);
|
||||
prop.putHTML("content_item_target", target);
|
||||
prop.put("content_item_code", license);
|
||||
prop.putHTML("content_item_name", shorten(image.imagetext, MAX_NAME_LENGTH));
|
||||
prop.put("content_item_mimetype", image.mimetype);
|
||||
prop.put("content_item_fileSize", 0);
|
||||
|
||||
String itemWidth = DEFAULT_IMG_WIDTH + "px", itemHeight = DEFAULT_IMG_HEIGHT + "px", itemStyle="";
|
||||
/* When image content is rendered by browser :
|
||||
* - set smaller dimension to 100% in order to crop image on other dimension with CSS style 'overflow:hidden' on image container
|
||||
* - set negative margin top behave like ViewImage which sets an offset when cutting to square */
|
||||
if (ViewImage.isBrowserRendered(imageUrlExt)) {
|
||||
if (image.width > image.height) {
|
||||
/* Landscape orientation */
|
||||
itemWidth = "";
|
||||
itemHeight = "100%";
|
||||
if(image.height > 0) {
|
||||
double scale = ((double)DEFAULT_IMG_HEIGHT) / ((double)image.height);
|
||||
int margin = (int)((image.height - image.width) * (scale / 2.0));
|
||||
itemStyle = "margin-left: " + margin + "px;";
|
||||
}
|
||||
} else {
|
||||
/* Portrait orientation, or square or unknown dimensions (both equals zero) */
|
||||
itemWidth = "100%";
|
||||
itemHeight = "";
|
||||
if(image.height > image.width && image.width > 0) {
|
||||
double scale = ((double)DEFAULT_IMG_WIDTH) / ((double)image.width);
|
||||
int margin = (int)((image.width - image.height) * (scale / 2.0));
|
||||
itemStyle = "margin-top: " + margin + "px;";
|
||||
}
|
||||
}
|
||||
}
|
||||
prop.put("content_item_width", itemWidth);
|
||||
prop.put("content_item_height", itemHeight);
|
||||
prop.put("content_item_style", itemStyle);
|
||||
prop.put("content_item_attr", ""/*(ms.attr.equals("-1 x -1")) ? "" : "(" + ms.attr + ")"*/); // attributes, here: original size of image
|
||||
prop.put("content_item_urlhash", ASCII.String(image.imageUrl.hash()));
|
||||
prop.put("content_item_source", image.sourceUrl.toNormalform(true));
|
||||
prop.putXML("content_item_source-xml", image.sourceUrl.toNormalform(true));
|
||||
prop.put("content_item_sourcedom", image.sourceUrl.getHost());
|
||||
prop.put("content_item_nl", (item == theSearch.query.offset) ? 0 : 1);
|
||||
prop.put("content_item", 1);
|
||||
} catch (MalformedURLException e) {
|
||||
prop.put("content_item", "0");
|
||||
}
|
||||
}
|
||||
|
||||
private static String shorten(final String s, final int length) {
|
||||
final String ret;
|
||||
|
@ -78,6 +78,9 @@ public class ImageParser {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (image == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final int handle = image.hashCode();
|
||||
mediaTracker.addImage(image, handle);
|
||||
|
@ -46,7 +46,7 @@ public class ViewImagePerfTest {
|
||||
|
||||
/** Default render max height (JPEG_example_JPG_RIP_100.jpg height / 10) */
|
||||
private static final int DEFAULT_MAX_HEIGHT = 23;
|
||||
|
||||
|
||||
/** Default encoding format */
|
||||
private static final String DEFAUL_EXT = "png";
|
||||
|
||||
@ -88,7 +88,7 @@ public class ViewImagePerfTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build post parameters to used with ViewImage
|
||||
* Build post parameters to use with ViewImage
|
||||
*
|
||||
* @param args
|
||||
* main parameters : second and third items may respectively
|
||||
@ -128,9 +128,22 @@ public class ViewImagePerfTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test image (JPEG_example_JPG_RIP_100.jpg) is scaled, and cropped.
|
||||
* Test image is parsed and rendered again and again until 20 seconds
|
||||
* elapsed. Then measured statistics are displayed.
|
||||
*
|
||||
* @param args
|
||||
* may be empty or contain parameters to override defaults :
|
||||
* <ul>
|
||||
* <li>args[0] : input image file URL. Default :
|
||||
* viewImageTest/test/JPEG_example_JPG_RIP_100.jpg</li>
|
||||
* <li>args[1] : max width (in pixels) for rendered image.
|
||||
* Default : default image width divided by 10.</li>
|
||||
* <li>args[2] : max height (in pixels) for rendered image.
|
||||
* Default : default image height divided by 10.</li>
|
||||
* <li>args[3] : output format name. Default : "png".</li>
|
||||
* </ul>
|
||||
* @throws IOException
|
||||
* when a read/write error occured
|
||||
*/
|
||||
public static void main(String args[]) throws IOException {
|
||||
File imgFile = getTestFile(args);
|
||||
|
267
test/ViewImageTest.java
Executable file
267
test/ViewImageTest.java
Executable file
@ -0,0 +1,267 @@
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.io.filefilter.FileFileFilter;
|
||||
|
||||
import net.yacy.cora.util.ConcurrentLog;
|
||||
import net.yacy.peers.graphics.EncodedImage;
|
||||
import net.yacy.server.serverObjects;
|
||||
|
||||
// ViewImageTest.java
|
||||
// -----------------------
|
||||
// part of YaCy
|
||||
// (C) by Michael Peter Christen; mc@yacy.net
|
||||
// first published on http://www.anomic.de
|
||||
// Frankfurt, Germany, 2006
|
||||
// created 03.04.2006
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
/**
|
||||
* Test rendering of one or more image files by ViewImage
|
||||
*
|
||||
* @author luc
|
||||
*
|
||||
*/
|
||||
public class ViewImageTest {
|
||||
|
||||
/** Default image */
|
||||
private static final String DEFAULT_IMG_RESOURCES = "/viewImageTest/test";
|
||||
|
||||
/** Default output encoding format */
|
||||
private static final String DEFAULT_OUT_EXT = "png";
|
||||
|
||||
/**
|
||||
* @param testFile
|
||||
* file to load
|
||||
* @return testFile content as a bytes array
|
||||
* @throws IOException
|
||||
* when an error occured while loading
|
||||
*/
|
||||
private static byte[] getBytes(File testFile) throws IOException {
|
||||
InputStream inStream = new FileInputStream(testFile);
|
||||
byte[] res = new byte[inStream.available()];
|
||||
try {
|
||||
inStream.read(res);
|
||||
} finally {
|
||||
inStream.close();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* main parameters. first item may contain input file or folder
|
||||
* URL
|
||||
* @return file or folder to be used : specified as first in args or default
|
||||
* one
|
||||
*/
|
||||
private static File getInputURL(String args[]) {
|
||||
String fileURL;
|
||||
if (args != null && args.length > 0) {
|
||||
fileURL = args[0];
|
||||
} else {
|
||||
URL defaultURL = ViewImageTest.class.getResource(DEFAULT_IMG_RESOURCES);
|
||||
if (defaultURL == null) {
|
||||
throw new IllegalArgumentException("File not found : " + DEFAULT_IMG_RESOURCES);
|
||||
}
|
||||
fileURL = defaultURL.getFile();
|
||||
}
|
||||
return new File(fileURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* main parameters. args[2] main contains directory url for
|
||||
* rendered images files
|
||||
* @return output directory to use
|
||||
* @throws IllegalArgumentException
|
||||
* when args[2] is not set and default is not found
|
||||
*/
|
||||
private static File getOuputDir(String[] args) {
|
||||
File outDir;
|
||||
if (args.length > 2) {
|
||||
outDir = new File(args[2]);
|
||||
} else {
|
||||
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||
if (tmpDir == null) {
|
||||
throw new IllegalArgumentException("No destination dir specified, and default not found");
|
||||
}
|
||||
outDir = new File(tmpDir + File.separator + ViewImageTest.class.getCanonicalName());
|
||||
}
|
||||
return outDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build post parameters to use with ViewImage
|
||||
*
|
||||
* @param args
|
||||
* main parameters : args[3] and args[4] may respectively contain
|
||||
* max width and max height
|
||||
* @return a serverObjects instance
|
||||
*/
|
||||
private static serverObjects makePostParams(String args[]) {
|
||||
serverObjects post = new serverObjects();
|
||||
if (args != null && args.length > 3) {
|
||||
int maxWidth = Integer.parseInt(args[3]);
|
||||
post.put("maxwidth", String.valueOf(maxWidth));
|
||||
}
|
||||
|
||||
if (args != null && args.length > 4) {
|
||||
int maxHeight = Integer.parseInt(args[4]);
|
||||
post.put("maxheight", String.valueOf(maxHeight));
|
||||
}
|
||||
|
||||
return post;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param args
|
||||
* main parameters : fourth item may contain extension
|
||||
* @return extension to use for encoding
|
||||
*/
|
||||
private static String getEncodingExt(String args[]) {
|
||||
String ext = DEFAULT_OUT_EXT;
|
||||
if (args != null && args.length > 3) {
|
||||
ext = args[3];
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display detailed results. All parametrers required not to be null.
|
||||
*
|
||||
* @param inFiles
|
||||
* input image files
|
||||
* @param failures
|
||||
* map input file url which failed with eventual cause exception
|
||||
*/
|
||||
private static void displayResults(File[] inFiles, Map<String, Exception> failures) {
|
||||
if (failures.size() > 0) {
|
||||
if (failures.size() == inFiles.length) {
|
||||
System.out.println("No input files could be processed :");
|
||||
} else {
|
||||
System.out.println("Some input files could not be processed :");
|
||||
}
|
||||
for (Entry<String, Exception> entry : failures.entrySet()) {
|
||||
System.out.println(entry.getKey());
|
||||
if (entry.getValue() != null) {
|
||||
System.out.println("cause : " + entry.getValue());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("All input files were successfully processed.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test image(s) (default : JPEG_example_JPG_RIP_100.jpg) are parsed and
|
||||
* rendered to an output foler. Result can then be checked with program of
|
||||
* your choice.
|
||||
*
|
||||
* @param args
|
||||
* may be empty or contain parameters to override defaults :
|
||||
* <ul>
|
||||
* <li>args[0] : input image file URL or folder containing image
|
||||
* files URL. Default :
|
||||
* viewImageTest/test/JPEG_example_JPG_RIP_100.jpg</li>
|
||||
* <li>args[1] : output format name (for example : "jpg") for
|
||||
* rendered image</li>
|
||||
* <li>args[2] : ouput folder URL</li>
|
||||
* <li>args[3] : max width (in pixels) for rendered image.
|
||||
* Default : no value.</li>
|
||||
* <li>args[4] : max height (in pixels) for rendered image.
|
||||
* Default : no value.</li>
|
||||
* </ul>
|
||||
* @throws IOException
|
||||
* when a read/write error occured
|
||||
*/
|
||||
public static void main(String args[]) throws IOException {
|
||||
File inURL = getInputURL(args);
|
||||
String ext = getEncodingExt(args);
|
||||
File outDir = getOuputDir(args);
|
||||
serverObjects post = makePostParams(args);
|
||||
outDir.mkdirs();
|
||||
|
||||
File[] inFiles;
|
||||
if (inURL.isFile()) {
|
||||
inFiles = new File[1];
|
||||
inFiles[0] = inURL;
|
||||
System.out.println("Testing ViewImage rendering with input file : " + inURL.getAbsolutePath()
|
||||
+ " encoded To : " + ext);
|
||||
} else if (inURL.isDirectory()) {
|
||||
FileFilter filter = FileFileFilter.FILE;
|
||||
inFiles = inURL.listFiles(filter);
|
||||
System.out.println("Testing ViewImage rendering with input files in folder : " + inURL.getAbsolutePath()
|
||||
+ " encoded To : " + ext);
|
||||
} else {
|
||||
inFiles = new File[0];
|
||||
}
|
||||
if (inFiles.length == 0) {
|
||||
throw new IllegalArgumentException(inURL.getAbsolutePath() + " is not a valid file or folder url.");
|
||||
}
|
||||
System.out.println("Rendered images will be written in dir : " + outDir.getAbsolutePath());
|
||||
|
||||
Map<String, Exception> failures = new HashMap<String, Exception>();
|
||||
try {
|
||||
for (File inFile : inFiles) {
|
||||
/* Delete eventual previous result file */
|
||||
File outFile = new File(outDir, inFile.getName() + "." + ext);
|
||||
if (outFile.exists()) {
|
||||
outFile.delete();
|
||||
}
|
||||
|
||||
byte[] resourceb = getBytes(inFile);
|
||||
String urlString = inFile.getAbsolutePath();
|
||||
EncodedImage img = null;
|
||||
Exception error = null;
|
||||
try {
|
||||
img = ViewImage.parseAndScale(post, true, urlString, ext, false, resourceb);
|
||||
} catch (Exception e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (img == null) {
|
||||
failures.put(urlString, error);
|
||||
} else {
|
||||
FileOutputStream outFileStream = null;
|
||||
try {
|
||||
outFileStream = new FileOutputStream(outFile);
|
||||
img.getImage().writeTo(outFileStream);
|
||||
} finally {
|
||||
if (outFileStream != null) {
|
||||
outFileStream.close();
|
||||
}
|
||||
img.getImage().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
displayResults(inFiles, failures);
|
||||
} finally {
|
||||
ConcurrentLog.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -27,10 +27,11 @@ td {
|
||||
</head>
|
||||
<body>
|
||||
<h2>
|
||||
Test page to check ViewImage rendering with different image formats
|
||||
listed in <a
|
||||
Test page to check ViewImage PNG rendering with different image
|
||||
formats of <a
|
||||
href="http://www.iana.org/assignments/media-types/media-types.xhtml#image"
|
||||
title="IANA Media Types">IANA Media Types page</a>, plus BMP format.
|
||||
title="IANA Media Types">IANA Registered Media Types</a>, plus BMP
|
||||
format.
|
||||
</h2>
|
||||
<h3>Prerequisites</h3>
|
||||
<ul>
|
||||
@ -45,6 +46,8 @@ td {
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th colspan="2">Render method</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -52,6 +55,8 @@ td {
|
||||
<th>Mime type</th>
|
||||
<th>File name extensions</th>
|
||||
<th>Long name/Description</th>
|
||||
<th>Specifications</th>
|
||||
<th>Test suite(s)</th>
|
||||
<th>YaCy ViewImage</th>
|
||||
<th>Direct browser</th>
|
||||
</tr>
|
||||
@ -64,6 +69,8 @@ td {
|
||||
<td>image/png</td>
|
||||
<td>.png</td>
|
||||
<td>Portable Network Graphics</td>
|
||||
<td><a href="https://tools.ietf.org/html/rfc2083">RFC 2083</a></td>
|
||||
<td><a href="http://www.schaik.com/pngsuite/pngsuite.html">Pngsuite</a></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -86,6 +93,38 @@ td {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Animated PNG : <a
|
||||
href="https://en.wikipedia.org/wiki/APNG#/media/File:Animated_PNG_example_bouncing_beach_ball.png"
|
||||
title="sample source url">sample source</a></td>
|
||||
<td>image/png</td>
|
||||
<td>.png, .apng</td>
|
||||
<td>Animated Portable Network Graphics</td>
|
||||
<td><a href="https://wiki.mozilla.org/APNG_Specification">APNG
|
||||
Specification</a></td>
|
||||
<td><a href="https://philip.html5.org/tests/apng/tests.html">APNG tests</a></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/Animated_PNG_example_bouncing_beach_ball.png"
|
||||
title="ViewImage render PNG sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Animated_PNG_example_bouncing_beach_ball.png"
|
||||
width="128" height="128" alt="ViewImage PNG render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a
|
||||
href="http://localhost:8090/env/grafics/test/Animated_PNG_example_bouncing_beach_ball.png"
|
||||
title="Browser render PNG sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/Animated_PNG_example_bouncing_beach_ball.png"
|
||||
height="100%" style="margin-left: -17%"
|
||||
alt="Browser PNG render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JPEG : <a
|
||||
href="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"
|
||||
@ -93,6 +132,8 @@ td {
|
||||
<td>image/jpeg</td>
|
||||
<td>.jpg, .jpeg, .jpe, .jif, .jfif, .jfi</td>
|
||||
<td>Joint Photographic Experts Group</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -121,12 +162,14 @@ td {
|
||||
<td>image/gif</td>
|
||||
<td>.gif</td>
|
||||
<td>Graphics Interchange Format</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.gif?url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
title="Render GIF sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.gif?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
width="128" height="128" alt="GIF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
@ -137,7 +180,7 @@ td {
|
||||
href="http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
title="Render GIF sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
|
||||
width="100%" alt="GIF render failed" />
|
||||
width="100%" style="margin-top: -8%" alt="GIF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
@ -149,12 +192,14 @@ td {
|
||||
<td>image/gif</td>
|
||||
<td>.gif</td>
|
||||
<td>Graphics Interchange Format</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.gif?url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
|
||||
title="Render animated GIF sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.gif?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
|
||||
width="128" height="128" alt="Animated GIF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
@ -177,12 +222,14 @@ td {
|
||||
<td>image/svg+xml</td>
|
||||
<td>.svg, .svgz</td>
|
||||
<td>Scalable Vector Graphics</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.svg?url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
|
||||
title="Render SVG sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.svg?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
|
||||
width="128" height="128" alt="SVG render failed" />
|
||||
</a>
|
||||
</div>
|
||||
@ -204,6 +251,8 @@ td {
|
||||
IANA)</td>
|
||||
<td>.ico</td>
|
||||
<td>Graphics file format for computer icons</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -232,6 +281,8 @@ td {
|
||||
registered at IANA)</td>
|
||||
<td>.bmp, .dib</td>
|
||||
<td>Windows Bitmap</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -247,7 +298,7 @@ td {
|
||||
<a href="http://localhost:8090/env/grafics/test/sails.bmp"
|
||||
title="Render BMP sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/sails.bmp"
|
||||
width="128" height="128" alt="BMP render failed" />
|
||||
height="100%" style="margin-left: -16%" alt="BMP render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
@ -259,6 +310,8 @@ td {
|
||||
<td>image/cgm</td>
|
||||
<td>.cgm</td>
|
||||
<td>Computer Graphics Metafile</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -286,6 +339,12 @@ td {
|
||||
<td>image/tiff, image/tiff-fx</td>
|
||||
<td>.tiff, .tif</td>
|
||||
<td>Tagged Image File Format</td>
|
||||
<td><a
|
||||
href="http://partners.adobe.com/public/developer/tiff/index.html">TIFF
|
||||
6.0 Specification</a></td>
|
||||
<td><a href="http://www.remotesensing.org/libtiff/images.html">libtiff</a>,
|
||||
<a
|
||||
href="https://github.com/haraldk/TwelveMonkeys/tree/master/imageio/imageio-tiff/src/test/resources/tiff">TwelveMonkeys</a></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -301,7 +360,7 @@ td {
|
||||
<a href="http://localhost:8090/env/grafics/test/marbles.tif"
|
||||
title="Render TIFF sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/marbles.tif"
|
||||
width="128" height="128" alt="TIFF render failed" />
|
||||
height="100%" style="margin-left: -13%" alt="TIFF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
@ -313,6 +372,8 @@ td {
|
||||
<td>image/fits, application/fits</td>
|
||||
<td>.fits, .fit, .fts</td>
|
||||
<td>Flexible Image Transport System</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
@ -341,11 +402,14 @@ td {
|
||||
<td>image/jp2, image/jpx, image/jpm, video/mj2</td>
|
||||
<td>.jp2, .j2k, .jpf, .jpx, .jpm, .mj2</td>
|
||||
<td>JPEG 2000</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a href="http://localhost:8090/ViewImage.png?url=relax.jp2"
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/relax.jp2"
|
||||
title="Render JPEG 2000 sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=relax.jp2"
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/relax.jp2"
|
||||
width="128" height="128" alt="JPEG 2000 render failed" />
|
||||
</a>
|
||||
</div>
|
||||
@ -366,6 +430,8 @@ td {
|
||||
<td>.ktx</td>
|
||||
<td>KTX (format for storing textures for OpenGL and OpenGL ES
|
||||
applications)</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -378,6 +444,8 @@ td {
|
||||
<td>image/naplps</td>
|
||||
<td>not known</td>
|
||||
<td>North American Presentation Layer Protocol Syntax</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -390,6 +458,8 @@ td {
|
||||
<td>image/prs.btif</td>
|
||||
<td>.btif, .btf</td>
|
||||
<td>Bank check images and ASCII text data, used by Nations Bank</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -402,6 +472,8 @@ td {
|
||||
<td>image/prs.pti</td>
|
||||
<td>.pti</td>
|
||||
<td>PTI</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -415,6 +487,8 @@ td {
|
||||
<td>none</td>
|
||||
<td>Used for printing "raw" image data in formats acceptable to
|
||||
printers</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -427,6 +501,8 @@ td {
|
||||
<td>image/t38</td>
|
||||
<td>none</td>
|
||||
<td>Only used for T.38 media stream in SDP</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -439,6 +515,8 @@ td {
|
||||
<td>image/vnd.adobe.photoshop</td>
|
||||
<td>.psd</td>
|
||||
<td>Adobe Photoshop file</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
@ -451,6 +529,451 @@ td {
|
||||
<td>image/vnd.airzip.accelerator.azv</td>
|
||||
<td>.azv</td>
|
||||
<td>AirZip file</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>image/vnd.cns.inf2</td>
|
||||
<td>none</td>
|
||||
<td>TRILOGUE INfinity network services platform from Comverse
|
||||
Network Systems, Ltd</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>image/vnd.dece.graphic</td>
|
||||
<td>.uvi, .uvvi, .uvg, .uvvg</td>
|
||||
<td>Digital Entertainment Content Ecosystem</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DjVu : <a
|
||||
href="https://upload.wikimedia.org/wikipedia/commons/9/9b/Specimens_of_calligraphy_and_natural_history_illustration.djvu"
|
||||
title="sample source url">sample source</a></td>
|
||||
<td>image/vnd-djvu</td>
|
||||
<td>.djvu, .djv</td>
|
||||
<td>DjVu</td>
|
||||
<td><a href="http://www.djvuzone.org/djvu/sci/djvuspec">DjVu
|
||||
Image Compression Format</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu"
|
||||
title="Render DjVu sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu"
|
||||
width="128" height="128" alt="DjVu render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a
|
||||
href="http://localhost:8090/env/grafics/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu"
|
||||
title="Render DjVu sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu"
|
||||
width="128" height="128" alt="DjVu render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DWG : <a href="http://libdwg.sourceforge.net/en/index.html"
|
||||
title="sample source url">sample source</a></td>
|
||||
<td>image/vnd.dwg</td>
|
||||
<td>.dwg</td>
|
||||
<td>DWG CAD drawings</td>
|
||||
<td><a
|
||||
href="http://opendesign.com/files/guestdownloads/OpenDesign_Specification_for_.dwg_files.pdf">ODA
|
||||
Open Design Specification for .dwg files</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/ACAD_r2000_sample.dwg"
|
||||
title="Render DWG sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/ACAD_r2000_sample.dwg"
|
||||
width="128" height="128" alt="DWG render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a
|
||||
href="http://localhost:8090/env/grafics/test/ACAD_r2000_sample.dwg"
|
||||
title="Render DWG sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/ACAD_r2000_sample.dwg"
|
||||
width="128" height="128" alt="DWG render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DXF</td>
|
||||
<td>image/vnd.dxf</td>
|
||||
<td>.dxf</td>
|
||||
<td>AutoCAD DXF (Drawing Interchange Format, or Drawing
|
||||
Exchange Format)</td>
|
||||
<td><a
|
||||
href="http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf">DXF
|
||||
Reference</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/ACAD_r2000_sample_original.dxf"
|
||||
title="Render DXF sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/ACAD_r2000_sample_original.dxf"
|
||||
width="128" height="128" alt="DXF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a
|
||||
href="http://localhost:8090/env/grafics/test/ACAD_r2000_sample_original.dxf"
|
||||
title="Render DXF sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/ACAD_r2000_sample_original.dxf"
|
||||
width="128" height="128" alt="DXF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SUB</td>
|
||||
<td>image/vnd.dvb.subtitle</td>
|
||||
<td>.sub</td>
|
||||
<td>Digital Video Broadcasting Subtitles</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FBS</td>
|
||||
<td>image/vnd.fastbidsheet</td>
|
||||
<td>.fbs</td>
|
||||
<td>FastBid Sheet</td>
|
||||
<td>Raster or vector images which represents engineering or
|
||||
architectual drawings.</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FPX</td>
|
||||
<td>image/vnd.fpx</td>
|
||||
<td>.fpx</td>
|
||||
<td>FlashPix multi resolution bitmap image file</td>
|
||||
<td>Extended from IVUE file format by Kodak. Specs are supposed
|
||||
to be provided by <a href="http://www.kodak.com">kodak</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FST</td>
|
||||
<td>image/vnd.fst</td>
|
||||
<td>.fst</td>
|
||||
<td></td>
|
||||
<td>No specification : used by Java applet viewer from FAST
|
||||
Search and Transfer ASA</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FST</td>
|
||||
<td>image/vnd.fujixerox.edmics-mmr</td>
|
||||
<td>.mmr</td>
|
||||
<td></td>
|
||||
<td>For Fuji Xerox 'EDMICS 2000' and 'DocuFile' applications
|
||||
(G4 or Modified Modified READ compression used in fax?)</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RLC</td>
|
||||
<td>image/vnd.fujixerox.edmics-rlc</td>
|
||||
<td>.rlc</td>
|
||||
<td></td>
|
||||
<td>For Fuji Xerox 'EDMICS 2000' and 'DocuFile' applications</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PGB</td>
|
||||
<td>image/vnd.globalgraphics.pgb</td>
|
||||
<td>.pgb</td>
|
||||
<td></td>
|
||||
<td>Limited use by tools using file reading technology licensed
|
||||
from Global Graphics such as Global Graphics Harlequin RIP</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MIX</td>
|
||||
<td>image/vnd.mix</td>
|
||||
<td>.mix</td>
|
||||
<td>Microsoft Digital Image Document</td>
|
||||
<td>No specification : used by Microsoft PhotoDraw 2000 and
|
||||
Microsoft Picture-It discontinued applications</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MODI</td>
|
||||
<td>image/vnd.ms-modi</td>
|
||||
<td>.mdi</td>
|
||||
<td>Microsoft Office Document Imaging</td>
|
||||
<td>Used by Microsoft Office Document Imaging application</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Radiance</td>
|
||||
<td>image/vnd.radiance</td>
|
||||
<td>.pic, .hdr, .rgbe, .xyze</td>
|
||||
<td>Radiance file</td>
|
||||
<td><a href="http://radsite.lbl.gov/radiance/refer">Reference</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SPNG</td>
|
||||
<td>image/vnd.sealed.png</td>
|
||||
<td>.spng, .spn, .s1n</td>
|
||||
<td>Sealed PNG</td>
|
||||
<td>Some information at <a
|
||||
href="http://docs.oracle.com/cd/E29542_01/doc.1111/e12278/idtoirmreference.htm#IDTUG240">Oracle
|
||||
IRM Desktop</a>.
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SGIF</td>
|
||||
<td>image/vnd.sealedmedia.softseal.gif</td>
|
||||
<td>.sgif, .sgi, .s1g</td>
|
||||
<td>Sealed GIF</td>
|
||||
<td>Some information at <a
|
||||
href="http://docs.oracle.com/cd/E29542_01/doc.1111/e12278/idtoirmreference.htm#IDTUG240">Oracle
|
||||
IRM Desktop</a>.
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SJPEG</td>
|
||||
<td>image/vnd.sealedmedia.softseal.jpeg</td>
|
||||
<td>.sjpg, .sjp, .s1j</td>
|
||||
<td>Sealed JPEG</td>
|
||||
<td>Some information at <a
|
||||
href="http://docs.oracle.com/cd/E29542_01/doc.1111/e12278/idtoirmreference.htm#IDTUG240">Oracle
|
||||
IRM Desktop</a>.
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SVF : <a href="http://www.svf.org/svflogo.svf"
|
||||
title="sample source url">sample source</a></td>
|
||||
<td>image/vnd-svf</td>
|
||||
<td>.svf</td>
|
||||
<td>Simple Vector Format</td>
|
||||
<td><a href="http://www.svf.org/spec.html">Specification
|
||||
for Simple Vector Format (SVF) v2.0</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/svflogo.svf"
|
||||
title="ViewImage render SVF sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/svflogo.svf"
|
||||
width="128" height="128" alt="ViewImage SVF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a href="http://localhost:8090/env/grafics/test/svflogo.svf"
|
||||
title="Browser render SVF sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/svflogo.svf"
|
||||
height="100%" style="margin-left: -17%"
|
||||
alt="Browser SVF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TAP</td>
|
||||
<td>image/vnd.tencent.tap</td>
|
||||
<td>.tap</td>
|
||||
<td>Tencent TAP</td>
|
||||
<td><a
|
||||
href="http://tu.qq.com/spec/image.vnd.tencent.tap-spec-en.txt">A
|
||||
file format that could represent a static image or multiple static
|
||||
images or an animation.</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>VTF: <a href="http://www.gaming-models.de/index.php/product/413"
|
||||
title="sample source url">sample source</a></td>
|
||||
<td>image/vnd.valve.source.texture</td>
|
||||
<td>.vtf</td>
|
||||
<td>Valve source texture</td>
|
||||
<td><a href="https://developer.valvesoftware.com/wiki/VTF">Unofficial
|
||||
specification</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">
|
||||
<a
|
||||
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/stone_wall.vtf"
|
||||
title="ViewImage render VTF sample in full size"> <img
|
||||
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/stone_wall.vtf"
|
||||
width="128" height="128" alt="ViewImage VTF render failed" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">
|
||||
<a href="http://localhost:8090/env/grafics/test/stone_wall.vtf"
|
||||
title="Browser render VTF sample in full size"> <img
|
||||
src="http://localhost:8090/env/grafics/test/stone_wall.vtf"
|
||||
height="100%" style="margin-left: -17%"
|
||||
alt="Browser VTF render failed"/>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WBMP</td>
|
||||
<td>image/vnd-wap-wbmp</td>
|
||||
<td>.wbmp</td>
|
||||
<td>Wireless Application Protocol Bitmap Format</td>
|
||||
<td>Page 13 in <a
|
||||
href="http://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf">WAP
|
||||
WAE Specification</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XIF</td>
|
||||
<td>image/vnd.xiff</td>
|
||||
<td>.xif</td>
|
||||
<td>eXtended Image File Format</td>
|
||||
<td>Should be provided by <a href="http://www.xerox.com">Xerox</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="browserthumb">No Sample</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PCX</td>
|
||||
<td>image/vnd.zbrush.pcx</td>
|
||||
<td>.pcx</td>
|
||||
<td>ZSoft PCX File Format</td>
|
||||
<td><a
|
||||
href="http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt">ZSoft
|
||||
PCX File Format Technical Reference Manual</a></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="thumbcontainer">No Sample</div>
|
||||
</td>
|
||||
|
BIN
test/viewImageTest/test/ACAD_r2000_sample.dwg
Executable file
BIN
test/viewImageTest/test/ACAD_r2000_sample.dwg
Executable file
Binary file not shown.
50806
test/viewImageTest/test/ACAD_r2000_sample_original.dxf
Executable file
50806
test/viewImageTest/test/ACAD_r2000_sample_original.dxf
Executable file
File diff suppressed because it is too large
Load Diff
BIN
test/viewImageTest/test/Animated_PNG_example_bouncing_beach_ball.png
Executable file
BIN
test/viewImageTest/test/Animated_PNG_example_bouncing_beach_ball.png
Executable file
Binary file not shown.
After ![]() (image error) Size: 64 KiB |
BIN
test/viewImageTest/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu
Executable file
BIN
test/viewImageTest/test/Specimens_of_calligraphy_and_natural_history_illustration.djvu
Executable file
Binary file not shown.
BIN
test/viewImageTest/test/stone_wall.vtf
Executable file
BIN
test/viewImageTest/test/stone_wall.vtf
Executable file
Binary file not shown.
BIN
test/viewImageTest/test/svflogo.svf
Executable file
BIN
test/viewImageTest/test/svflogo.svf
Executable file
Binary file not shown.
Reference in New Issue
Block a user