Latest Nathan Wallpaper zapping *.png's ? [SOLVED]

Please post any bugs you have found
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Latest Nathan Wallpaper zapping *.png's ? [SOLVED]

#1 Post by musher0 »

Hello, all.

That's a new behavior in Wallpaper, eh? It never happened before.

In wary 5.5, the Nathan Wallpaper utility is now zapping *.png's, and of course, no good deed going unpunished, it also erases your current background. So you end up with the default light grey background, and 0 Kb for your favorite *.png.

I understand *.png's generally take more space than *.jpg's, but please, that's a decision for the user to make, not the developer. To whoever last fiddled with the Nathan Wallpaper script: make a public confession, and perhaps you'll be pardoned! ;)

Moral of this story is: find and use an older version of "Nathan Wallpaper", not the current one. Older versions don't have this bug.

BFN.
Last edited by musher0 on Wed 27 Mar 2013, 17:23, edited 3 times in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

I remember I had such occurrence once, too. I think it is code in
/usr/sbin/background_reshape . Will have to look for it . It might have something to do with file name with spaces or some used binary ie jpegtopnm pamcut pnmcut and their libraries.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Hello, Karl.

I'm not advanced enough, unlike yourself, to edit the code. So I un-installed the 0.6 version and re-installed wallpaper_lupu-0.5.4.1.pet.

However thanks for the confirmation that I was not seeing things !!!

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#4 Post by 01micko »

I was the last one to modify Nathan's wallpaper setter.

It is default in Slacko and the default image is a PNG ! No problems reported. I wonder if this is a Wary specific bug?

NB: as far as I know, Slacko uses the same netpbm tools as Wary, this is responsible for the cropping in Barry's code to which Karl refers.
Puppy Linux Blog - contact me for access

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

01micko wrote:I was the last one to modify Nathan's wallpaper setter.

It is default in Slacko and the default image is a PNG ! No problems reported. I wonder if this is a Wary specific bug?

NB: as far as I know, Slacko uses the same netpbm tools as Wary, this is responsible for the cropping in Barry's code to which Karl refers.
Hi, 01micko.

Long time no see, eh? :) I hope you are well.

As I said, I'm not expert enough to venture in the code -- and truly, I have other fish to fry. ;)

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#6 Post by Karl Godt »

musher0,
Wary-5.5 seems not to have Nathan Wallpaper Setter installed by default.
It must be the wallpaper-setter by BK then, as I look into puppy_wary-5.5.sfs/usr/local/apps .

Will boot and check tomorrow or later today.
musher0 wrote:and truly, I have other fish to fry. Wink

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Karl Godt wrote:musher0,
Wary-5.5 seems not to have Nathan Wallpaper Setter installed by default.
It must be the wallpaper-setter by BK then, as I look into puppy_wary-5.5.sfs/usr/local/apps .

Will boot and check tomorrow or later today.
musher0 wrote:and truly, I have other fish to fry. Wink
Hello, Karl.

Don't you like fish? It's Holy Week, a good Christian is supposed to be fasting! :wink:

Oh, I know wary uses the rigid pwallpaper to set up the backdrop of the screen.

Some users might not know this: If a user wants to choose any picture located anywhere on the computer, (s)he is better off using the built-in background setter in ROX-Filer. See how-to illustrations below.

BFN.
Attachments
ROX-as-background-changer.jpg
To activate the background setting option, click Options in a ROX-filer panel, go to "compatibilities", and un-tick "Pass all clicks..." You can re-set it to normal after you've changed the backdrop.
(54.48 KiB) Downloaded 650 times
ROX-as-background-changer2.jpg
To actually change the backdrop this way, open any image folder, ri"ght click on background and click on "background image". A panel appears. Set the preferences, and slide your preferred image on it, and it's done.
(33.69 KiB) Downloaded 1558 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#8 Post by Karl Godt »

musher01 : Where did you get the wallpaper-0.6[.x].pet from ?

I have found the blog of BK by using google : Nathan's Wallpaper Setter 0.6
that led here : Nathan Wallpaper Setter -update
and on ftp://ftp.nluug.nl/../pub/ibiblio/distributions/quirky/pet_packages-common/
there is a 0.6.1-1.pet plus a 0.5.6.pet .
/usr/local/bin/ppm shows two pets from the puppy-noarch repo in the Desktop part as
simple_wall-set-0.6-noarch
and
wallpaper-0.6.1-1
,
-noarch meaning no binaries but scripts and picts included .
Have dl the lupu-0.5.4.1.pet you mentioned and the three from Mik's thread,
diff -up them and there is not much of interest and apparently no binaries included,
probably a change from $IMAGE to $1 between 6.0 to 6.1 which might screw things if $1 gets passed to a function,

but have pet2tgz them all and tgz xzf them to diff them,
ran ./AppRun inside the 0.6.1- version directory and applied it on a pic dl from http://hubblesite.org/gallery/wallpaper/pr2010013a/640_wallpaper and it worked for me,
have no widescreen monitor though to test correctly.
There are some mismatches still for sometimes filename variables get doublequotes and sometimes not to act correctly with :SPACE: 's ; the default /usr/sbin/pwallpaper at least does not support spaces .

So there are few "Latest" wallpaper setters around, would be somehow cool if you could at least roughly remember where you got them from.

About fish : I don't hate fish, but seldom eat it. Fish can be smoked or put into vinegar, too, though that was not that was Jesus liked bound to that cross .. but Simon of Cyrene was told to bear the cross behind him, one gospels says .. maybe he stepped onto the purple cloth , they fell down and somehow suddenly there was some other guy dying for him ..

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

Hello, Karl.

Well, there is a problem with PPM, in that 1) ibiblio is unavailable because it has "moved permanently", and 2) the other dl sites have their recursive analysis de-activated.

I'll try to access the sites manually.

BFN.

musher0
Attachments
PPM-recursive-deactivated-1.jpg
(61.65 KiB) Downloaded 1617 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Hello, again.

Sorry for bringing this up, but Your test might be inconclusive, since it is a jpg file.
http://imgsrc.hubblesite.org/hu/db/imag ... lpaper.jpg

Have you tried with one or more *.png images ?

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

Hi.

This with wallpaper 6.1 dl'd directly from ftp://mirror.aarnet.edu.au/pub/quirky/p ... .6.1-1.pet

I'll try to locate a 6.0 version and try again.

musher0
Attachments
no-luck-with-png-wallpaper-6.1.jpg
(57.12 KiB) Downloaded 1683 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

Hello again.

In the meantime, one can revert to wallpaper-0.5.x and use this powerful workaround :

Code: Select all

#!/bin/sh
# ~/my-applications/bin/wlppr-lnks.sh
# musher0, March 26, 2013.
####
ln /usr/local/apps/Wallpaper /root/.config/rox.sourceforge.net/OpenWith/.image_jpeg/
ln /usr/local/apps/Wallpaper /root/.config/rox.sourceforge.net/OpenWith/.image_png/
### 30 ###
This will create a "wallpaper" link in the right-click menu under jpg and png images. With this, you can go to any picture directory, make the pictures the biggest possible, and right-click on a picture and make it a "wallpaper" choice.

With these little links, you see a nice picture in any picture directory and you have the ability to make it a backdrop. This is actually more intuitive than the current offering, in my opinion.

TWYL.

musher0
Attachments
wlppr-lnks.sh.tar.gz
(241 Bytes) Downloaded 551 times
wallpaper-0.5-workaround.jpg
(42 KiB) Downloaded 1801 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#13 Post by Karl Godt »

extracted the version 0.6.1-1.pet in a sandbox,
opened the .jpg in mtpaint and saved as .png and .gz9.png (without compression and with compressionlevel9) ,
ran ./AppRun and it worked for me,
also on the /usr/share/backgrounds/wary_stark.png .
No truncations detected.

Even in locale
LANG=fr_CA.UTF-8
LC_CTYPE="fr_CA.UTF-8"
LC_NUMERIC="fr_CA.UTF-8"
LC_TIME="fr_CA.UTF-8"
LC_COLLATE="fr_CA.UTF-8"
LC_MONETARY="fr_CA.UTF-8"
LC_MESSAGES="fr_CA.UTF-8"
LC_PAPER="fr_CA.UTF-8"
LC_NAME="fr_CA.UTF-8"
LC_ADDRESS="fr_CA.UTF-8"
LC_TELEPHONE="fr_CA.UTF-8"
LC_MEASUREMENT="fr_CA.UTF-8"
LC_IDENTIFICATION="fr_CA.UTF-8"
LC_ALL=
Have
export LC_ALL=fr_CA.UTF-8
and then it gives me
expr: non-numeric argument
/usr/sbin/background_reshape: line 59: [: -ge: unary operator expected
which did not matter anything , no empty files.

*SIDENOTE : WIZARDWIZARD->LANGUAGESETTING restarted X automatically without asking me to close all Apps or doing it later.
Unfortunately some code got worse, Wary-5.5 is no option for me :evil:

wjaguar
Posts: 359
Joined: Wed 21 Jun 2006, 14:16

#14 Post by wjaguar »

Karl Godt wrote:Have
export LC_ALL=fr_CA.UTF-8
and then it gives me
expr: non-numeric argument
/usr/sbin/background_reshape: line 59: [: -ge: unary operator expected
This happens because the script expects decimal separator to be ".", and in some locales it is "," instead. And a chain reaction of unexpected behaviour follows.

To prevent these things from happening, it is best to put "export LC_NUMERIC=C" at the beginning of a script, if it's making any kind of floating-point calculations.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#15 Post by musher0 »

wjaguar wrote:
Karl Godt wrote:Have
export LC_ALL=fr_CA.UTF-8
and then it gives me
expr: non-numeric argument
/usr/sbin/background_reshape: line 59: [: -ge: unary operator expected
This happens because the script expects decimal separator to be ".", and in some locales it is "," instead. And a chain reaction of unexpected behaviour follows.

To prevent these things from happening, it is best to put "export LC_NUMERIC=C" at the beginning of a script, if it's making any kind of floating-point calculations.
Edit, March 30th: 2 paragraphs removed (self-censored).

Luckily the French-from-France Toutou has almost solved the non- fr_FR keyboard problems at start-up. (...)(self-censored)

Regards.

musher0
Last edited by musher0 on Sat 30 Mar 2013, 07:55, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#16 Post by musher0 »

in any case, i can confirm that this wallpaper utility works in wary 5.5 : http://distro.ibiblio.org/puppylinux/pe ... .5.4.1.pet

It doesn't show the pictures, but if you put links in the appropriate ROX-types (see above), it does.
You just have to think "picture to wallpaper" instead of "wallpaper from picture".

Meaning:
  • Make the links as indicated above.
    Browse to any picture folder.
    Right-click on the eye in the ROX-Filer, the thumbs will show.
    Click twice on the "+" icon to make the thumbs the largest.
    Find a nice picture.
    Right-click on it.
    Click on "wallpaper" in the sub-menu,
and voilà, you new wallpaper is in place.

Minor caveat:
For now,don't do anything involving a recycling of the PuppyPin directly.
At your earliest convenience, recycle the X server, and
the name of your picture will be properly registered in PuppyPin.

Best.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#17 Post by Karl Godt »

wjaguar wrote:
Karl Godt wrote:Have
export LC_ALL=fr_CA.UTF-8
and then it gives me
expr: non-numeric argument
/usr/sbin/background_reshape: line 59: [: -ge: unary operator expected
This happens because the script expects decimal separator to be ".", and in some locales it is "," instead. And a chain reaction of unexpected behavior follows.

To prevent these things from happening, it is best to put "export LC_NUMERIC=C" at the beginning of a script, if it's making any kind of floating-point calculations.
Yeah found myself in there. If somebody would have told me, i had submitted a patch therefore, i could not remember it anymore :oops: .

Anyway the script seems to work to backup screwed wallpapers :D .

BUT : Filename with spaces are not supported throughout the whole script,
and instead of math gymnastics by dc it seems to be able to achieve all this with ash and bash math without the need for a delimiter for cut.
These two shell gymnastics worked for me, too :

Code: Select all

# echo "123,456" | awk -F '[[:punct:]]' '{print $1}'
123
# echo "123,456" | sed 's%[[:punct:]].*%%'          
123
# 
*
Have still a hard time to understand these LC_* and .UTF-8 things .
As far as I have read the docs, ".UTF-8" was always the extension syntax, dunno why some distros had used .utf8, .utf-8 or .UTF8 . UTF-8 seems not to work for German in Puppy-4.3.x .

Anyway, wjaguar : You are doing a great job on mtpaint. Thanks muchly for it !

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#18 Post by musher0 »

Hello, all.

Sorry for the emotional outburst earlier today.

I've checked all versions 0.6.x of Wallpaper and the 01micko's "simple wallpaper seter" in wary 5.5 and they all have the same *.png problem. As to pwallpaper, you're out of luck if you want a backfdrop that's not in /usr/share/backgrounds.

If I understand correctly, you're saying it's a problem with the background-reshape script, that interprets decimals wrongly. I looked at BK's code : isn't there a way to make that dc calculator use rounded numbers ? Or use another console calculator utility that does ?

Just a thought. BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#19 Post by 01micko »

Karl, your patch is in slacko:-

Code: Select all

#!/bin/sh
#Barry Kauler 2009
#the background image is at /usr/share/backgrounds/default.jpg
#this may have the wrong dimensions to suit either a 'normal' or a 'widescreen' monitor.
#for now, keep this simple, assume image is suitable for normal screen, truncate vertically
#if widescreen.
#v424 fix maths.
#v424 move ORIGINAL-* images to /usr/share/backgrounds_original
#110831 support png images.
#111013 Karl Godt: 'dc' can return , instead of . in numeric values, for non-english locale.

export LANG=C #111013 fix for 'dc'.

#accept optional image file as passed param...
[ -f /usr/share/backgrounds/default.png ] && IMAGEFILE="/usr/share/backgrounds/default.png"
[ -f /usr/share/backgrounds/default.jpg ] && IMAGEFILE="/usr/share/backgrounds/default.jpg"
[ $1 ] && IMAGEFILE="$1"
[ "$IMAGEFILE" = "" ] && exit

#v423 precaution, if someone has chosen the backup original...
[ "`echo -n "$IMAGEFILE" | grep 'ORIGINAL'`" != "" ] && exit

IMAGEPATH="`dirname $IMAGEFILE`"
mkdir -p "${IMAGEPATH}_original" #v424
IMAGEBASE="`basename $IMAGEFILE`"
IMAGEEXT="`echo -n "$IMAGEBASE" | rev | cut -f 1 -d '.' | rev`"

#[ "$IMAGEEXT" != "jpg" ] && [ "$IMAGEEXT" != "jpeg" ] && [ "$IMAGEEXT" != "JPG" ] && [ "$IMAGEEXT" != "JPEG" ] && exit
case $IMAGEEXT in
 jpg|jpeg|JPG|JPEG) IMAGEEXT='jpg' ;;
 png|PNG) IMAGEEXT='png' ;;
 *) exit ;;
esac

#first boot, maybe trying different video modes, so this causes reset each time...
if [ ! -f ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} ];then #v424
 cp -f ${IMAGEFILE} ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} #v424
else
 cp -f ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} ${IMAGEFILE} #restore. v424
fi

if [ "$IMAGEEXT" = "jpg" ];then
 IMAGEDIMS="`jpegtopnm ${IMAGEFILE} 2>/dev/null | pamfile 2>&1 | grep 'stdin:' | tr -s ' ' | cut -f 2 -d ',' | cut -f 2,4 -d ' '`" #ex: 1200 800
else
 IMAGEDIMS="`pngtopnm ${IMAGEFILE} 2>/dev/null | pamfile 2>&1 | grep 'stdin:' | tr -s ' ' | cut -f 2 -d ',' | cut -f 2,4 -d ' '`" #ex: 1200 800
fi
IMAGEHORIZ=`echo -n "$IMAGEDIMS" | cut -f 1 -d ' '`
IMAGEVERT=`echo -n "$IMAGEDIMS" | cut -f 2 -d ' '`

ROOTDIMS="`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' '`"
ROOTHORIZ=`echo -n "$ROOTDIMS" | cut -f 1 -d ' '`
ROOTVERT=`echo -n "$ROOTDIMS" | cut -f 2 -d ' '`

#v423...
RATIOIMAGE=`dc $IMAGEHORIZ $IMAGEVERT div 100 mul p | cut -f 1 -d '.'`
RATIOROOT=`dc $ROOTHORIZ $ROOTVERT div 100 mul p | cut -f 1 -d '.'`
#echo "RATIOIMAGE=$RATIOIMAGE RATIOROOT=$RATIOROOT" #TEST
xRATIOIMAGE=`expr $RATIOIMAGE + 5` #allow for roundoff errors.
[ $xRATIOIMAGE -ge $RATIOROOT ] && exit

#v423 some math gymnastics involved here...
IMGVERTSCALED=`dc $ROOTHORIZ $IMAGEHORIZ div $IMAGEVERT mul p`
VERTDIFF=`dc $IMGVERTSCALED $ROOTVERT sub p`
NEWIMGVERTSCALED=`dc $IMGVERTSCALED $VERTDIFF sub p`
NEWVERT=`dc $IMAGEHORIZ $ROOTHORIZ div $NEWIMGVERTSCALED mul p | cut -f 1 -d '.'` #v424 fix.

#echo "IMGVERTSCALED=$IMGVERTSCALED VERTDIFF=$VERTDIFF NEWIMGVERTSCALED=$NEWIMGVERTSCALED NEWVERT=$NEWVERT" #TEST

#this method only cuts off the bottom of image...
#if [ $xNEWVERT -lt $IMAGEVERT ];then
# jpegtopnm ${IMAGEFILE} | pamdice -height=${NEWVERT} -outstem=/root/out #creates out_0_0.ppm
# [ $? -ne 0 ] && exit
# pnmtojpeg -quality=85 out_0_0.ppm > ${IMAGEFILE}
# rm -f /root/out_*.ppm
#fi

#this method cuts equal amount from top and bottom...
if [ $NEWVERT -lt $IMAGEVERT ];then #precaution
 PAMCUT="pamcut"
 [ "`which pnmcut`" != "" ] && PAMCUT="pnmcut" #older netpbm.
 CUTVERT=`expr $IMAGEVERT - $NEWVERT`
 TOP=`expr $CUTVERT \/ 2`
 BOTTOM=`expr $NEWVERT + $TOP`
# jpegtopnm ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} | ${PAMCUT} -left=0 -right=${IMAGEHORIZ} -top=${TOP} -bottom=${BOTTOM} | pnmtojpeg -quality=85 > ${IMAGEFILE}
 if [ "$IMAGEEXT" = "jpg" ];then
  jpegtopnm ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} | ${PAMCUT} -left=0 -top=${TOP} -bottom=${BOTTOM} | pnmtojpeg -quality=85 > ${IMAGEFILE}
 else
  pngtopnm ${IMAGEPATH}_original/ORIGINAL-${IMAGEBASE} | ${PAMCUT} -left=0 -top=${TOP} -bottom=${BOTTOM} | pnmtopng > ${IMAGEFILE}
 fi
fi

###END###
/usr/sbin/background_reshape

Christian.. is it not the same in Wary?

As a test

Get a png in root and make sure it is 4*3 aspect, or close enough. Then run

Code: Select all

background_reshape nameofpic.png
What happens?
Puppy Linux Blog - contact me for access

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#20 Post by musher0 »

No problems with Wallpaper 0.6.2 in good old dpup 485... which uses a iso locale, iso-8859-1.
Vv-ee-rr-yy strange...
Attachments
works-fine-in-dpup-485(iso-8859-1).jpg
(47.02 KiB) Downloaded 868 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply