# New Release: jpegwriter



## The Jake

http://www.allaboutjake.com/tivo/jpegwriter.html

For your enjoyment. Display JPEGs on your Tivo.

Consider it pre-beta software. Use at your own risk. It has no error handling capability to speak of. It pretty much just dumps a JPEG to your OSD.

If you're really slick, you can use it to write a nice TCL script to do a slide show or something. I might get around to adding slide show capabilities to another jpeg app in the future.

Enjoy, and please send me your bugs. but read this carefully:
*USE JPEGWRITER AT YOUR OWN RISK!*

It worked for the 10 or so JPEGs I tried. Thats no guarantee it will work for every one.

Jake


----------



## feldon23

Got enough disclaimers?


----------



## controlio

Do not taunt JPG2OSD.


----------



## The Jake

Hehe, no, never enough disclaimers. 

as for jpg2osd, didn't know it existed or I might not have bothered with this... even so, I haven't found it anywhere... search on google was negative, as was a search in this forum.

Jake


----------



## alatar

So far, it has worked for everyone I've tried, various sizes and shapes. But I would like for them to display a little larger. But I'm not complaining. I think this is awesome. Can't wait to show it off later.

Alatar
Philips 82-hr SA


----------



## The Jake

The JPEG library supports scaling at 1/2 1/4 or 1/8th its actual size. The API supports scaling to any fraction, but the implementation of libjpeg only supports those fractions.

JPEG writer bascially starts at 1/1, if it fits, then fine, if not, it tries 1/2, then 1/4, then 1/8-- until it fits.

Basically, any image smaller than 700 wide x 460 tall should be displayed at the 1/1 ratio.

If you find any problems, or have any suggestions, let me know.

Jake


----------



## kronos80

Using all the standard disclaimers...

Here is a tivoweb module to make use of jpegwriter.

1) Just place this in your tivoweb modules directory.

2) Place jpegwriter and all your jpegs into /var/hack/pics.

3) Restart tivoweb.

Thanks Jake and ligntn for these tools. I know I use them almost everyday.

kronos80

[email protected]


----------



## Otto

> _Originally posted by kronos80 _
> *Using all the standard disclaimers...
> 
> Here is a tivoweb module to make use of jpegwriter.
> *


Might be good to attach the file or at least point to where it's located.


----------



## kronos80

woops


> _Originally posted by Otto _
> *
> 
> Might be good to attach the file or at least point to where it's located.  *


----------



## Richy_T

Is there any information on the osd routines?


----------



## GregV

Just curious, but are you resampling the image when you scale down? i.e. when you display at 1/2, do you throw out every other line or average every pair together?

Since you're only supporting 1/2, 1/4, and 1/8, it would be pretty easy to resample the images to improve display quality. It's when you're not scaling evenly that the code becomes harder and more processor-intensive.


----------



## The Jake

Richy:

Look at the released source to tivovbi if you want to learn about the OSD. Thats what I did.

Greg:

Actually, the scaling is done by libjpeg, not by me. LibJpeg lets you select a scaling factor out of those you listed. Actaully, when using those scaling factors, the JPEG decompression process is simplified and takes less processing power than the entire image.

So basically, if scaling to 1/2, 1/4 or 1/8, its much more economical to use LibJPEG, since it simplifies the JPEG decompression. However, to scale to an abritrary factor, I'd have to include a secondary image scaling routine.

I was looking for a simple library that has the ability to scale images, but I didn't look that hard and kind of lost interest. 

Jake


----------



## Zodiacal

i got it to display on my tivo but how to i get it to go away?


----------



## Graham Cobb

I have created a new version of jpegwriter, based on Jake's original. As well as fixing a small bug (which fixed a crash on one image for me) the main change is to add options to control the placement of the image on the screen. This includes an option to use UK (PAL) screen dimensions.

Many thanks are, of course, due to Jake for releasing his code under the GPL. However, bear in mind that Jake has no responsibility for this version and for all the bugs I have no doubt introduced into his fine code!

Jpegwriter V1.1 is available from http://www.cobb.uk.net/Tivo/Jpegwriter/ .

Let me know if you find any problems with this version.

P.S. I have a new version of slideshow as well, but that is a note for a different topic.


----------



## Zirak

This version also does a better job of "centering" the image, leaving "less" (to none) chopped off by the right hand side of the screen. :up: 

However, it has an odd behavior that version 1.0 did not have. jpegwriter has no "clear screen" option. Pressing live-tv will clear the image, and "reset" the tivos color properties back to the "tivo standard." (Likely the pallete is the issue) However, if you press something else, say the right arrow to bring up the current channel display, it leaves garbage on the screen. (Both 1.0 and 1.1 did this)

However with 1.0 you can effectively clear the screen by displaying a "blank" jpeg, and the garbage doesn't reappear when you right arrow. With 1.1 the blank jpeg will clear the screen but the garbage will reappear when you press the right arrow key. 

live-tv is apparently the only button that will "clear" the problem. Changing channels, hitting enter, etc all leave garbage on the screen. This makes it problematic to clear the screen programmatic. 

An option to jpegwriter to return the tivo back to its default settings along with clearing the image would be useful. Alternatively restoring the original behavior of being able to effectively clear the screen using a blank jpeg would also work, the former being preferable.

I prefer the output of version 1.1 and would like to use that version to display the weather maps in TCS, but, IMHO, the inability to clear the screen, even by the convoluted method of using a blank jpeg makes it more of a pain than the display improvement is worth, at least in how I am using it.

Will you consider adding an option to clear the screen, or be willing to investigate how to get the "blank" jpeg option working again?

Writing the screen with 1.1 and "clearing" it with 1.0 works, but thats rather ugly.

(Well, clearing the screen with a blank jpeg is also ugly, but when you pile more ugliness on top of ugly...)

If you want a copy of blank.jpg, its in the TCS distribution, or I will provide a direct link, if you like.


----------



## acacia

I can't seem to get the tivoweb module jpeg.itcl to display files starting with r. It chops off the first character.

Attached is the version I was playing with (difference: it shows the full pathname before the link) : I've got it working for most files, but those starting with lower case r are not listing properly

/var/hack/pics/rose.jpg ose.jpg

e.g. rose.jpg displays in the list as ose.jpg and causes:

INTERNAL SERVER ERROR
--cut here--
action_jpeg '/ose' ''
jpegwriter - v1.1 by Graham R. Cobb (c) 2003 Graham R. Cobb
--> Derived from jpegwriter - v1.0b by Jake B.	(c) 2002 Jake B.
--> TiVo and the TiVo logo are trademarks of TiVo Inc.
--> Thanks (yet again) to [mbm] for all his help.
--> libosd: 1.1 - libosd (c) 2003 Graham R. Cobb

Error opening file: /var/hack/pics/ose.jpg
while executing
"exec /bin/bash -c "/var/hack/pics/jpegwriter -P /var/hack/pics/$path.jpg" "
(procedure "::action_jpeg" line 16)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

I can rename the files as a quick workaround, but any help appreciated. - I'm guessing its the way TCL is doing string manipulation on the pathnames - is /r an escaped character or something?

regards,

Jonathan


----------



## uktivo

erm how do you install it? I read the readme and it makes no mention of installation?


----------



## john1980

Version 1.2 is an extension of the latest version (v1.1) that includes support for clearing the on screen display.

Version 1.0a-p1 is an extension of the oldest version (v1.0a) that includes support for clearing the on screen display and is just included for completeness.

Most of you will just be after the jpegwriter binary found in jpegwriter-1.2.zip


----------



## Graham Cobb

Coincidentally I needed to make a change to libosd today!

I have put jpegwriter V1.2 in my Tivo pages at http://www.cobb.uk.net/Tivo/Jpegwriter/ and have also put a new libosd V1.3 up at http://www.cobb.uk.net/Tivo/Libosd/


----------



## john1980

libosd(1.4) now resets the geometry and colour palette of the screen - this allows your to clear the screen and then display characters to it with newtext2osd which was not previously possible as newtext2osd does not provide its own palette.

jpegwriter(1.3) now detects if it is a UK or US Tivo in an attempt to default to the correct screen geometry (eg PAL vs NTSC), and includes the new libosd library.


----------



## kelsky

I can't seem to get jpegwriter working on my series 2 unit that is running 6.2.


bash-2.02# tivosh ./jpegwriter
extra characters after close-brace
while compiling
"{ ..."
while compiling
"[| ..."
(file "./jpegwriter" line 19)
bash-2.02# 

Any suggestions are appreciated. 

Oh, I have tried ver 1.1, 1.2 & 1.3 and they all give me the same message. I have three Hughes DVR40's and they all react the same.


----------



## john1980

kelsky said:


> I can't seem to get jpegwriter working on my series 2 unit that is running 6.2.
> 
> bash-2.02# tivosh ./jpegwriter
> extra characters after close-brace
> while compiling
> "{ ..."
> while compiling
> "[| ..."
> (file "./jpegwriter" line 19)


You are going to have some pretty serious problems getting it going. Firstly it is a binary and not a TCL script, so it can not be run via tivosh (which is a TCL interpreter). Secondly the binary has been compiled for a PowerPC processor (Series 1 TiVo) and will not run on a MIPS processor (Series 2 TiVo). If you wish to get the application working on a series 2 unit you will need to install gcc and compile it from the source code... however I would not bother as it is very unlikely to work as all the ioctl's (commands) will be different - if they even exist at all.

Short answer is that it (and many other modules/utilities) will not work on series 2 units.


----------



## PyroMan

acacia said:


> I can't seem to get the tivoweb module jpeg.itcl to display files starting with r. It chops off the first character.
> 
> Attached is the version I was playing with (difference: it shows the full pathname before the link) : I've got it working for most files, but those starting with lower case r are not listing properly
> 
> /var/hack/pics/rose.jpg ose.jpg
> 
> e.g. rose.jpg displays in the list as ose.jpg and causes:
> 
> INTERNAL SERVER ERROR
> --cut here--
> action_jpeg '/ose' ''
> jpegwriter - v1.1 by Graham R. Cobb (c) 2003 Graham R. Cobb
> --> Derived from jpegwriter - v1.0b by Jake B.	(c) 2002 Jake B.
> --> TiVo and the TiVo logo are trademarks of TiVo Inc.
> --> Thanks (yet again) to [mbm] for all his help.
> --> libosd: 1.1 - libosd (c) 2003 Graham R. Cobb
> 
> Error opening file: /var/hack/pics/ose.jpg
> while executing
> "exec /bin/bash -c "/var/hack/pics/jpegwriter -P /var/hack/pics/$path.jpg" "
> (procedure "::action_jpeg" line 16)
> invoked from within
> "::action_$action $chan $part $env"
> ("eval" body line 1)
> invoked from within
> "eval {::action_$action $chan $part $env}"
> --cut here--
> 
> I can rename the files as a quick workaround, but any help appreciated. - I'm guessing its the way TCL is doing string manipulation on the pathnames - is /r an escaped character or something?
> 
> regards,
> 
> Jonathan


OK, I am now able to make my first real contribution to TiVo hackers. I have discovered that the problem with the first character being cut off is due to the use of the "string trim[left or right]" commands. The correct method is to use "file tail" and "file rootname".

In other words change this line


Code:


puts $chan [html_link [string trimleft [string trimright "$pic" ".jpg"]  "/var/hack/pics/"] [string trimleft "$pic" "/var/hack/pics/"] ]

to


Code:


puts $chan [html_link [file tail [file rootname "$pic"]] [file tail "$pic"] ]

I hope this helps.


----------



## acacia

Great! Thank you!


----------



## jar-head

john1980 said:


> If you wish to get the application working on a series 2 unit you will need to install gcc and compile it from the source code... however I would not bother as it is very unlikely to work as all the ioctl's (commands) will be different - if they even exist at all.
> 
> Short answer is that it (and many other modules/utilities) will not work on series 2 units.


I have been trying to get jpegwriter to work on my Series 2 DirecTivo until I read this. Are there any alternatives that will alow me to display an image of any kind on my tivo?


----------



## lloydjs

I have a series 1 w/ TivoWeb v1.9.4

jpegwriter works fine from bash prompt by issuing the command: 
jpegwriter <jpeg_filename.jpg>

However, it doesn't work with TivoWeb (Jpeg Viewer module) nor will it work with slideshow.tcl (http://www.cobb.uk.net/Tivo/Slideshow/)

Both attempts flash the image very briefly and then the screen goes white.
I tried various versions of jpegwriter - 1.1, 1.2, 1.3 - and all produce the same results - only work from bash prompt.

I am thinking the jpeg module and the slideshow require something else that the standalone excecutable does not, maybe some libosd files.
The readme for jpegwriter states that libosd is required but I didn't put them on the Tivo. I thought I would try it with just jpegwriter and it worked fine from the bash prompt. Do you think this could be my problem? If so, where would the libosd files go? The readme files don't provide much instruction as far as how to install and where to put the files.

Thanks to all the helpful people in the forum community, I no longer consider myself a newbie, but far from an expert.

Thank you!

PS: My TivoWeb has a bunch of grey boxes at the top that look like they might be buttons but don't do anything and have no text. Is this normal? Maybe I have a bad TivoWeb install.


----------

