Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-13-2013, 12:20 PM   #151
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@dimasic

Yes, it is possible to make a screenshot in Librerator - but on K3 . I thought that screenshots are a gimmick not needed for reading books - they're only useful for posting pictures on forums - so I thought limited amount of shortcut combinations on K4NT are better used elsewhere. But, it's not hard to modify the source and change one of the existing shortcuts to do a screenshot.

If you can't do it by yourself, tell me what shortcut you'd like to change, and I'll provide you with a patch.

Regards,
Kai
Kai771 is offline   Reply With Quote
Old 04-13-2013, 04:27 PM   #152
dimasic
Enthusiast
dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'
 
Posts: 43
Karma: 10000
Join Date: Apr 2013
Device: Kindle 4NT
OK, I've managed to change combination of keys ScreenKB - KEY_FW_UP from "Add Bookmark" to "Make Screenshot" in CRE module by replacing self:addBookmarkCommand() with Screen:screenshot() in corresponding section of crereader.lua. When I press these buttons, it says: "Screenshot is ready in blah-blah-blah", creates file of screenshot in bmp format, but.. it looks like that:



Yes, indeed I tried to open non-valid file, it's only an example. But the screen does not look so ugly. There's message "ERROR: Error reading PDB format. Cannot open document". With other files, which are valid and I can open and read with CRE, the same thing: screen looks OK, but screenshot is not.

I tried to modify screen.lua to use function fb2pgm instead of fb2bmp, because it can work with 8bpp framebuffer of K4. It's OK, but picture is inverted.

So, it's necessary to add condition for K4 to screen.lua and probably modify fb2bmp and/or fb2pgm functions.
dimasic is offline   Reply With Quote
Old 04-14-2013, 02:44 AM   #153
NuPogodi
Connoisseur
NuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the end
 
Posts: 58
Karma: 31942
Join Date: Feb 2012
Device: Kindle 3, Tolino Shine, Kobo Glo
Quote:
Originally Posted by dimasic View Post
I tried to modify screen.lua to use function fb2pgm instead of fb2bmp, because it can work with 8bpp framebuffer of K4. It's OK, but picture is inverted.

So, it's necessary to add condition for K4 to screen.lua and probably modify fb2bmp and/or fb2pgm functions.
The functions to store framebuffer content into common graphic formats were written to work properly with K2, K3 & KDX(G). I had neither newer kindle models (or their framebuffer dumps), nor intention to make this function universal.
Try to download the attached zip, unpack its content to ../screenshots/ and to replace the function in screen.lua
Code:
Screen:screenshot()
local format = "bmp" -- or tiff or pgm
os.execute("./screenshots/screen2"..format)
end
PS The attached binaries were also not tested with K4
Attached Files
File Type: zip screenshots.zip (13.7 KB, 148 views)

Last edited by NuPogodi; 04-14-2013 at 03:29 AM.
NuPogodi is offline   Reply With Quote
Old 04-14-2013, 04:37 AM   #154
dimasic
Enthusiast
dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'
 
Posts: 43
Karma: 10000
Join Date: Apr 2013
Device: Kindle 4NT
Well, it works on K4NT - all of the formats. But picture is still inverted as in case of calling Screen:fb2pgm() function with 8bpp parameter. Black is white and white is black.

And maybe it's better to modify "Screen:" functions in lua than add three more compiled files? So any advanced user can modify this module without recompiling of C source - to fix some incompatibility or to add his own features.

At this moment I have changed
Code:
self:fb2bmp("/dev/fb0", lfs.currentdir().."/screenshots/"..os.date("%Y%m%d%H%M%S")..".bmp", true, nil)
with
Code:
if Device:getModel() == "Kindle4" then
	self:fb2pgm("/dev/fb0", lfs.currentdir().."/screenshots/"..os.date("%Y%m%d%H%M%S")..".pgm", "bzip2 ", 8)
else
	self:fb2bmp("/dev/fb0", lfs.currentdir().."/screenshots/"..os.date("%Y%m%d%H%M%S")..".bmp", true, nil)
end

Last edited by dimasic; 04-14-2013 at 04:41 AM.
dimasic is offline   Reply With Quote
Old 04-14-2013, 05:39 AM   #155
NuPogodi
Connoisseur
NuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the end
 
Posts: 58
Karma: 31942
Join Date: Feb 2012
Device: Kindle 3, Tolino Shine, Kobo Glo
Quote:
Originally Posted by dimasic View Post
And maybe it's better to modify "Screen:" functions in lua than add three more compiled files?
If the following code still does not work, you may adjust it by yourself -- i still have neither K4 nor the framebuffer dump made by some lucky K4-owner.
Udachi!
Spoiler:

Code:
function Screen:fb2pgm(fin, fout, pack, bpp)
	local inputf = assert(io.open(fin,"rb"))
	if inputf then
		local outputf = assert(io.open(fout,"wb"))
		outputf:write("P5\n# Created by kindlepdfviewer\n"..G_width.." "..G_height.."\n255\n")
		if bpp == 8 then -- then needs free memory of G_width bytes, and not too fast
			local i, j, line
			for i=1, G_height do
				line = inputf:read(G_width)
				for j=1, G_width do
					outputf:write(string.char(255-string.byte(line, j)))
				end
			end
		else
...

Last edited by NuPogodi; 04-14-2013 at 07:50 AM. Reason: Added: string.char
NuPogodi is offline   Reply With Quote
Old 04-14-2013, 07:25 AM   #156
dimasic
Enthusiast
dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'
 
Posts: 43
Karma: 10000
Join Date: Apr 2013
Device: Kindle 4NT
It does not work at all. Dark grey background with no visible information.

In K4 reading of framebuffer with read() function returns bytes, in which high 4 bits are equal to low 4 bits. So all the bytes look as 00, 11, 22, ... FF. But I can't find the way to translate XX into 0X - and not sure that it should be so in the resulting 8bit pgm. I'm not familiar with Lua and had not programming practice for years, alas. I tried to build array as for 4bpp devices, but with different values; tried to read values byte by byte and divide them with math.floor by 16, but it won't work still.

I would appreciate your help, but I'll try to do it by myself. It's interesting task for me. Anyway, it's possible to make inverted screenshot and invert it with external tools - any raster graphics editor or something like imagemagick, it's not a big problem.
dimasic is offline   Reply With Quote
Old 04-14-2013, 08:13 AM   #157
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by dimasic View Post
It does not work at all. Dark grey background with no visible information.

In K4 reading of framebuffer with read() function returns bytes, in which high 4 bits are equal to low 4 bits. So all the bytes look as 00, 11, 22, ... FF. But I can't find the way to translate XX into 0X - and not sure that it should be so in the resulting 8bit pgm. I'm not familiar with Lua and had not programming practice for years, alas. I tried to build array as for 4bpp devices, but with different values; tried to read values byte by byte and divide them with math.floor by 16, but it won't work still.

I would appreciate your help, but I'll try to do it by myself. It's interesting task for me. Anyway, it's possible to make inverted screenshot and invert it with external tools - any raster graphics editor or something like imagemagick, it's not a big problem.
Yes, that 4bits duplicated in the high/low nibble of a byte is a hardware requirement.
Just set the high 4 bits to zero - the image is stored 4bits per byte.
knc1 is offline   Reply With Quote
Old 04-15-2013, 01:48 AM   #158
dimasic
Enthusiast
dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'
 
Posts: 43
Karma: 10000
Join Date: Apr 2013
Device: Kindle 4NT
Lua's type conversion made me crazy. But when my code has made screenshot with its own colors, I suddenly noticed that the code is almost identical to the NuPogodi's code (after he made some corrections).

In resulting file the high and the low bits are still equal, so the tiny loss of contrast in highlights should be. But who cares?
dimasic is offline   Reply With Quote
Old 04-15-2013, 06:16 AM   #159
T86
Junior Member
T86 began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2012
Device: Kindle 3 WiFi
Hi!

Thank you for the great program there is really huge progress compared to a years old version of kpdfviewer I used before. I especially like the possibility to reflow the pdf while mathematic formulas survive.

I do however have some questions:

1. I could not find a description of what the (global and local) preferences mean. Could you please add this to the users guide. For example what do "Defect size", "Auto straighten" and "Render quality" actually do?
2. Is it possible to paste the beginning of the next page/column under the end of the current one in reflow mode (e.g. when there are only two lines left on the page, could the next page begin without turning the page)?
3. Can the next page be processed in the background, so that turning pages is faster?
4. With my installation of kindlepdfviewer I got two "books" one for opening the file browser and one for the latest document. Now I have to start KUAL this way and then select one of these options. Is it possible to have such "fake books" again with librerator?

Thank you and keep up your great work!
T86 is offline   Reply With Quote
Old 04-15-2013, 08:48 AM   #160
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@T86

Reflow of pdf/djvu files is not exclusive feature of Librerator. Recent version of KPV support it too. In fact, Librerator was forked after this feature was introduced to KPV. Current version of KPV probably uses newer version of k2pdfopt library.

1. I don’t use reflow all that much. You’d better ask chrox about it (he’s the guy that added it to KPV), or you can try k2pdfopt page:

http://www.willus.com/k2pdfopt/

2. The feature you’re requesting is commonly called “scroll mode”. Librerator and current version of KPV (as far as I know) do not support this. KOReader development team plans to add this feature to KOReader eventually (if I understood correctly).

3. Reflow mode does processing in the background (if multi-threading is on). However, it does take a few seconds, and it only processes next page. You can’t quickly flip through pages in reflow mode.

4. This is covered in this post. Librerator wiki - Known bugs and features mentions this also.

Regards,
Kai
Kai771 is offline   Reply With Quote
Old 04-15-2013, 09:34 AM   #161
T86
Junior Member
T86 began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2012
Device: Kindle 3 WiFi
@Kai771
Thank you!

It seems the solution to 4 is to install kite instead of or in addition to kual.

So do I understand you correctly that koreader, kpv and librerator exist in parallel? Until now I had assumed that kpv is no longer maintained but split into koreader (for touch devices) and librerator (for key based navigation)...
T86 is offline   Reply With Quote
Old 04-15-2013, 09:42 AM   #162
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by Kai771 View Post
2. The feature you’re requesting is commonly called “scroll mode”. Librerator and current version of KPV (as far as I know) do not support this. KOReader development team plans to add this feature to KOReader eventually (if I understood correctly).
JFYI, scroll mode is already implemented in KOReader.
eureka is offline   Reply With Quote
Old 04-15-2013, 09:45 AM   #163
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 145
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
@T86

No, KPV didn't split into koreader and Librerator. Librerator is a fork of KPV. KPV evolved into koreader. Current release of koreader supports only touch devices, but support for all kindles will eventually be added, too.

The old codebase, KindlePDFViewer is still maintained, and it's latest release is newer than Librerator-R2.

Librerator, as a fork, has some features that KPV doesn't. It's kinda like my version of KPV .

Regards,
Kai
Kai771 is offline   Reply With Quote
Old 04-15-2013, 10:26 AM   #164
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
I might add that Librerator is probably the one in the bunch that is fit for the K4 since good ol' KPV is very centered around use via a full keyboard (i.e. K2,K3,KDX).
hawhill is offline   Reply With Quote
Old 04-16-2013, 06:22 AM   #165
dimasic
Enthusiast
dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'dimasic knows the difference between 'who' and 'whom'
 
Posts: 43
Karma: 10000
Join Date: Apr 2013
Device: Kindle 4NT
A couple of thoughts about BBox feature.

It would be nice to see the "Manually set BBox" and "Remove BBox" items in the "Select Zoom Mode" menu as it is used only with some of zoom modes.

It would be nice if in "Fit to content" and "Fit to height" modes narrow page will center on the screen (now it aligns left and looks not very much aesthetic).
dimasic is offline   Reply With Quote
Reply

Tags
application, epub, fb2, pdf, reader

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi format 'Add' help fixit4u Library Management 1 04-21-2012 10:54 AM
I have a Kindle, can I order books other than Multi-format chilady1 Amazon Kindle 3 01-19-2010 04:46 PM
fictionwise multi-format... except .mobi demoric Amazon Kindle 4 10-02-2009 12:05 PM
Multi-format Reader theplotthickens Which one should I buy? 5 05-04-2009 03:19 AM
Master Format for multi-format eBook Generation? cerement Workshop 43 04-01-2009 12:00 PM


All times are GMT -4. The time now is 04:22 PM.


MobileRead.com is a privately owned, operated and funded community.