Extend Image preview formats support

Forum for developers

Extend Image preview formats support

Beitragvon luc » Di Okt 06, 2015 8:10 pm

Hi everyone, currently, file formats support is quite limited in YaCy Images search results preview.
As far as I know, on current github version only major formats are correctly displayed : png, jpeg, bmp, ico plus gif and svg unscaled (if anyone is interested I started a test file to check it : https://github.com/luccioman/yacy_search_server/tree/master/test/viewImageTest).
Don't you think it would be interesting to have some more image formats rendered in thumb preview, such as JPeg2000 or Tiff as they are not so uncommon?

As Java SE JDK doesn't support theses formats, additional libraries such as https://github.com/haraldk/TwelveMonkeys could be used.
A small refactoring would be necessary on ViewImage.java : javax.imageio.ImageIO.read(URL) would be used instead of java.awt.Toolkit .createImage(URL). This way using JDK SPI system of ImageIO, future new image formats could be easily added with no more refactoring needed on ViewImage.

Do you think it is a good idea? I am ready to implement and test this but if anyone is already on this subject I let this to you.

Another point of view could be to stop rendering image previews with YaCy ViewImage class and rely solely on browser rendering with its eventual plugins... Maybe a configuration option could let user switch between the 2 rendering systems? Maybe someone have other suggestions?
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon Orbiter » Mi Okt 07, 2015 11:19 am

luc hat geschrieben:Do you think it is a good idea? I am ready to implement and test this but if anyone is already on this subject I let this to you.

Thats a very good idea: I had a look at the formats which TwelveMonkeys supports and I found a lot of document types which are usually stored in file systems. Because YaCy also indexes intranets/file systems, this would be of great use.

luc hat geschrieben:Another point of view could be to stop rendering image previews with YaCy ViewImage class and rely solely on browser rendering with its eventual plugins... Maybe a configuration option could let user switch between the 2 rendering systems? Maybe someone have other suggestions?

I tested this already in the context of https://github.com/yacy/yacy_webclient_bootstrap which is rendering the image results with the browser. This is actually much better if the images are not too big (which is the common case) but it would not work with the file formats not appropriate for the browser. Maybe we can mix up the display using rendering in the browser or with viewImages as it is appropriate for the corresponding file format/size!
Orbiter
 
Beiträge: 5786
Registriert: Di Jun 26, 2007 10:58 pm
Wohnort: Frankfurt am Main

Re: Extend Image preview formats support

Beitragvon luc » Do Okt 08, 2015 11:21 am

I hadn't initially thought to file system indexing use case : in fact it especially make sense in this context.
As soon I have time I will first try playing with TwelveMonkeys library and add some performance and non-regression tests.
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon luc » Do Okt 15, 2015 10:06 am

Hello, I just created a Pull Request (https://github.com/yacy/yacy_search_server/pull/18).
For now I only added Tiff format support with twelvemonkeys library and didn't use twelve monkeys jpeg, ico and bmp formats plugins as I was not convinced by performance tests.
More automated tests and eventually more file formats support to come next weeks. Feedback is welcome.
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon Orbiter » Fr Okt 16, 2015 10:41 pm

Great work, I just tested this and it looks like its working fine. I found a glitch when I tried to open an image preview which does not work with tiff files, but it might also be a problem with the browser. I believe the enlarged version of the thumbnail does not go through YaCy but is rendered by the browser directly, so this problem is not related to your changes but it could be fixed using your new code to transfer a re-rendered image to the enlarged view. But that is an add-on work, not a bug.
Thank you!
Orbiter
 
Beiträge: 5786
Registriert: Di Jun 26, 2007 10:58 pm
Wohnort: Frankfurt am Main

Re: Extend Image preview formats support

Beitragvon luc » Sa Okt 17, 2015 12:06 pm

Ok, thank you for testing. Examples tiff images I found with YaCy search displayed correctly in full size on my computer with firefox. I thougth full size preview also passed in YaCy ViewImage servlet. I will extend tests next week and see.
Edit : it seems I didn't read correctly your post. In fact it is true that gif and svg formats are rendered directly by browser. Is it with one of these formats you had a problem? If you provide the example file or url I'm insterested to have a look.
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon luc » Mo Okt 19, 2015 9:16 am

Arrh, I finally got it! I was trapped by images with '.tif' extension being actually jpeg files such as http://www.siemens.com/innovation/de/home/publications/industry-and-automation/additive-manufacturing-dossier/teaserpage/_jcr_content/imageTeaserWide.adapt.609.high.jpg/1411239515428.tif.
Will be more careful with that in the future. I will try to fix tiff full size preview and add a HTML test file working exactly the same way as search results page.
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon luc » Fr Okt 23, 2015 3:21 pm

Hello, I fixed full size preview of TIFF images, and some other little issues : https://github.com/yacy/yacy_search_server/pull/21.
Notes :
- Konqueror web browser has built-in support for Tiff images
- Tiff rendering based on twelve monkeys library works well but doesn't support some Tiff features like CCITT T.4 compression or exotic pixels bits depths : you can easily check it with new ViewImageTest class and for example test suite from libtiff (http://www.remotesensing.org/libtiff/images.html

Next week planned works :
- rendering of large image files, at least to ensure no OutOfMemoryError can occur.
- add a generic system to rely on browser rendering when image format is not supported by YaCy, as it is done today, but only for gif and svg
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am

Re: Extend Image preview formats support

Beitragvon luc » Fr Nov 20, 2015 8:05 pm

Hello, it has been a while since last post... but image processing is not so easy, and when you think you improved something, you might easily have broken something else.
But I have done my best on time available, passed many tests, and have some code to share with you : .https://github.com/yacy/yacy_search_server/pull/26.
There is still much to be done on the subject, and I will share with you once I have something tested and working!
luc
 
Beiträge: 276
Registriert: Mi Aug 26, 2015 1:04 am


Zurück zu YaCy Coding & Architecture

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste

cron