09-06-2013, 08:40 AM | #1 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
set gamma&contrast with fw 4.2 & 4.4 (pb622)
hi there
from release notes: "SETTINGS: 1. Implemented contrast and gamma correction mechanism in Adobe and DjVu (this setting is brought in global.cfg)." On pdf books with images or complex layout is better, imho, the normal view of adobeviewer, without reflow. That has an adverse effect giving small fonts and greyish character. Adjusting gamma & correction could help improving readibility. While we wait for an integration in pb menu, anyone tried to do/did a script to modify global.cfg? I use pieditor by fjodr, but is a little bit annoying. Paolo Last edited by paolog; 12-18-2013 at 12:13 PM. Reason: changed the title |
10-23-2013, 11:45 AM | #2 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
at the end I did a script to modify the gamma settings for Adobe and DjVu viewer, with the use of iv_shtool made by rkomar to have a graphic interface
https://www.mobileread.com/forums/sho...d.php?t=163556 below there is my code; I'm not a programmer so it's quite raw and naive Code:
#!/bin/ash SH_IVTOOL=/mnt/ext1/system/bin/sh_ivtool.app STATUS="`cat /mnt/ext1/system/config/global.cfg | grep Gamma`" ANSWER=`$SH_IVTOOL -q "$STATUS Change gamma settings for Adobe or DjVu reader?"` if [ $? -eq 0 -a "$ANSWER" == "y" ]; then BACKUP=`$SH_IVTOOL -q "Make a backup of global.cfg in the same place?"` if [ $? -eq 0 -a "$BACKUP" == "y" ]; then cp /mnt/ext1/system/config/global.cfg /mnt/ext1/system/config/global.cfg.old fi PRG=`$SH_IVTOOL -o Adobe DjVu` CHANGE="`echo "$STATUS" | grep "$PRG"`" NEW=`$SH_IVTOOL -t "$CHANGE (new x.x)"` # here would be nice to test that NEW is grather than 0 #if [[ $NEW > 0 ]]; then #$SH_IVTOOL -s "MAGGIORE DI ZERO" #fi if [ $? -eq 0 -a "$PRG" == "Adobe" ]; then sed -i "s/GammaLevelAdobe=.*/GammaLevelAdobe="$NEW"/" /mnt/ext1/system/config/global.cfg fi if [ $? -eq 0 -a "$PRG" == "DjVu" ]; then sed -i "s/GammaLevelDjVu=.*/GammaLevelDjVu="$NEW"/" /mnt/ext1/system/config/global.cfg fi $SH_IVTOOL -s "New gamma settings: `cat /mnt/ext1/system/config/global.cfg | grep Gamma`" fi exit edit: note: added bulletproof suggestions ( $? -eq 0 -a ) in the if tests ___ could anyone help me in testing whether $NEW is greather than 0 ? thanks paolo Last edited by paolog; 10-23-2013 at 05:07 PM. |
Advert | |
|
10-23-2013, 12:06 PM | #3 |
Nameless Being
|
Did you tried
Code:
if [ $NEW -gt 0 ]; then Regards Ronny |
10-23-2013, 12:19 PM | #4 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
hi Ronny
yes, -gt is for integer PB gamma has 1 decimal allowed (I use 2.6 for istance) I tried: [ $NEW -gt 0 ] [ $NEW > 0 ] [[ $NEW -gt 0 ]] [[ $NEW > 0 ]] then any kind of combination of quotation of the terms of comparison |
10-23-2013, 12:23 PM | #5 |
Nameless Being
|
Is it always with one decimal?
|
Advert | |
|
10-23-2013, 12:40 PM | #6 |
Nameless Being
|
What is the whole range of this parameter? Maybe it is enough to test $new == "0.0"
Regards |
10-23-2013, 12:41 PM | #7 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
boh?
I tried to catch the difference between 2.999 and 2.9, for istance, but is very hard anyway Adobe reader doesn't refuse to work with 2.999 |
10-23-2013, 12:54 PM | #8 |
Nameless Being
|
Maybe you can test "$NEW" == "0.0" and "$NEW" == "-"* (if NEW runs below 0)?
|
10-23-2013, 12:56 PM | #9 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
even $NEW == "0.0" doesn't work
nor "" == "" Last edited by paolog; 10-23-2013 at 12:58 PM. |
10-23-2013, 01:12 PM | #10 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
sorry [ $NEW == "0.0" ]
works (but they're treated as string here, right?) negative digits are accepted by the reader, doesn't look very well but works, so I'll allow negative numbers for special situations where it could be handy that said I think is useless this check thank you very much Ronny! |
10-23-2013, 01:43 PM | #11 |
Nameless Being
|
|
10-23-2013, 03:06 PM | #12 |
Wizard
Posts: 2,986
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
In this case they are. The sh_ivtool.app program is outputting string data to stdout.
Besides, numbers are only allowed to be integers in shell scripts, so trying to assign a floating point number like 2.9 to an integer wouldn't have worked right anyway. You should either handle the mantissa and the fractional parts separately, or use something like awk to deal with floating point numbers. paolog, to make your code more bulletproof, you should be testing the return code of sh_ivtool.app before using the output. It's possible that someone can just hit the escape button in the middle of the dialog and it won't be outputting any proper string. So, as in the README.txt file: Code:
NUM=`sh_ivtool -n "Enter a number:"` if [ $? -eq 0 ]; then if [ "$NUM" > "0" ]; then echo It's bigger than 0! fi fi Code:
NUM=`sh_ivtool -n "Enter a number:"` if [ $? -eq 0 -a "$NUM" > "0" ]; then echo It's bigger than 0! fi |
10-23-2013, 04:53 PM | #13 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
hi rkomar!
I'm absolutely un-aware as programmer I'll amend the script edit done! btw, what happens if $? isn't zero? Last edited by paolog; 10-23-2013 at 05:03 PM. |
10-23-2013, 06:34 PM | #14 |
Wizard
Posts: 2,986
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
It usually means that someone canceled the action (with escape button or otherwise). It can also mean that the wrong arguments were passed to sh_ivtool.app in the first place. I think I just return -1 whenever a proper response isn't available for any reason. I didn't try to return different codes for different errors.
P.S. shell scripting is not easy when you try to do more complicated things. The limitations can make the code quite complex. So, don't feel bad; your code is quite alright. Last edited by rkomar; 10-23-2013 at 06:39 PM. |
10-24-2013, 05:07 PM | #15 |
Zealot
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
|
thanks rkomar
I'm very happy with my script now! I've a lot of pdf that now I can enjoy! anyway, for anyone that could be interested attached there is the last script, with the use of function() too! wow! paolo |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kobo Touch - Contrast, Page numbers & Responsiveness | blizeH | Kobo Reader | 7 | 08-10-2012 04:36 AM |
How do you set up a PC & TV to stream Amazon video? | jswinden | Kindle Fire | 16 | 11-26-2011 02:59 PM |
IQ IQ people, new gamma (?) firmware 2.1.2 | paola | PocketBook | 4 | 06-28-2011 06:00 PM |
Contrast & Brightness Adjustability | Rizla | Amazon Kindle | 2 | 12-25-2010 12:02 PM |
Contrast&Glare: PocketBook 302 vs BeBook Neo | Hadel | Which one should I buy? | 7 | 06-20-2010 11:25 PM |