|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Any idea on why "native" sage thumbnail is missing color?
I wrote a servlet that serves up the SageTV thumbnail for a given media file. The image that it returns is the correct image, but the color is all wrong. Any ideas on how I can "correct" the image so that it has the correct color?
Here the source code and 2 images. The first is the image that this code is returning... the second image is the image that I would expect... Code:
private void writeSageImage(String mediaFileId, HttpServletResponse resp) throws Exception { // get the media file that we are going to be using Object sagefile = MediaFileAPI.GetMediaFileForID(Integer.parseInt(mediaFileId)); Object sageImage = MediaFileAPI.GetThumbnail(sagefile); // find a method in the sage image that returns a RawImage Method method = null; Method m[] = sageImage.getClass().getMethods(); for (int i=0;i<m.length;i++) { if (sage.media.image.RawImage.class.equals(m[i].getReturnType())) { // potential contender method = m[i]; break; } } if (method == null) throw new Exception("No Method to return image!"); RawImage rimg = (RawImage) method.invoke(sageImage, new Object[] {0}); BufferedImage img =rimg.convertToBufferedImage(); resp.setContentType("image/jpeg"); OutputStream os = resp.getOutputStream(); ImageIO.write((RenderedImage) img, "jpeg", os); os.flush(); }
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#2
|
||||
|
||||
If you look at the perimeter in the original image it is white (R=255, G=255, B=255 ), but in the bad image the RGB values are R=255, G=128, B=128. In the black areas the bad image values are R=0, G=128, B=128.
It almost looks like there was some bit shifting (by 8 bits?) or something like that happening. Maybe if you took a look at both images in a hex editor, you might see a pattern. Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#3
|
||||
|
||||
I'm not familiar with most of those classes and methods, but the things I'd be looking at are:
1. Is "image/jpeg" really the correct content type for the object you're getting back from the undocumented method you're invoking? 2. I don't see the OutputStream being closed anywhere (although you do flush it). 3. Could there be some sort of text v. binary stream confusion that's causing inappropriate CRLF translation?
__________________
-- Greg |
#4
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
Thanks guys for your expertise on this.... If anything else comes to mind let me know. For now, maybe I'll play with some filters and see if it's as simple as applying some simple transformation. Thanks.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#5
|
||||
|
||||
Quote:
Quote:
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#6
|
||||
|
||||
Quote:
But.... i took a look at nielm's code and I noticed that he's not sending back the format in a "jpg" format, but rather a "png" format. So I changed the code to tell the ImageIO to send back png... and it works as expected.... Thanks for sending this along... now I can remove my "undocumented api" hack. thanks! Quote:
Code:
// return the thumbnail http://server:8080/sagex/media/thumbnail/MEDIA_FILE_ID // return media stream http://server:8080/sagex/media/mediafile/MEDIA_FILE_ID // return custom properties http://server:8080/sagex/media/properties/MEDIA_FILE_ID
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient Last edited by stuckless; 10-15-2008 at 01:27 PM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sage Server with no internet access, need a creative solution | wazkaren | General Discussion | 49 | 09-19-2008 08:57 PM |
Symptoms of a sick and dying wiz.bin | roadtoad | SageTV Software | 1 | 12-23-2007 01:37 PM |
Purevideo color controls irrelevant since upgrade to 1.02-223 | FZ1 | Hardware Support | 5 | 02-02-2007 12:49 PM |
DVD menu indicators missing while plaing DVDs via Sage | ripple | SageTV Software | 5 | 12-19-2006 12:48 PM |
Sage UI disappears during playback | Keith | SageTV Software | 17 | 03-03-2006 03:31 AM |