Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 01-26-2020, 11:48 PM   #61
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by JSWolf View Post
Can the official plugin resize keeping the cover's aspect ratio and use Calibre's lossless compression?
Of course not. Think about it. The image is being resized. Either bits are thrown away to make it smaller, or they are added to make it bigger.

And this is different from the compression in the editor. That only changes the copy in the book, not the copy in the library. If you want to do a bulk compress of the images in the books, use the Polish Books tool.
davidfor is offline   Reply With Quote
Old 01-27-2020, 02:22 AM   #62
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by davidfor View Post
The plugin works by resizing the current cover to the selected size. With the keep aspect ratio, it resizes the cover to fit within the selected size. Whether the height or width is used, depends on the relative aspect ratios of the image and the selected size. This feels like the right way to do it. The size selected is probably related to something else such as the resolution of an ereader. The resize is to fit the cover within that size.
@davidfor - does the release version of the plugin have code to maintain the aspect ratio of the image when it resizes a cover.jpg?

BR

Last edited by BetterRed; 01-27-2020 at 02:25 AM.
BetterRed is offline   Reply With Quote
Advert
Old 01-27-2020, 02:47 AM   #63
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by BetterRed View Post
@davidfor - does the release version of the plugin have code to maintain the aspect ratio of the image when it resizes a cover.jpg?
No. I think that @gingerbeardman version is more correct. I hadn't noticed the difference in how the two did the resize (KeepAspectRatio vs KeepAspectRatioByExpanding - I prefer the former). I also prefer the way it does the configuration.
davidfor is offline   Reply With Quote
Old 01-27-2020, 06:40 AM   #64
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by davidfor View Post
No. I think that @gingerbeardman version is more correct. I hadn't noticed the difference in how the two did the resize (KeepAspectRatio vs KeepAspectRatioByExpanding - I prefer the former). I also prefer the way it does the configuration.
My primary interest is removing the 'experimental/unofficial' versions, and updating the first post with a new 'official' version. Happy to let you make the call as to which one that should be.

What about converting to Py3, should that be done now or later?

BR

Last edited by BetterRed; 01-27-2020 at 10:18 AM.
BetterRed is offline   Reply With Quote
Old 01-27-2020, 10:29 AM   #65
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JSWolf View Post
delete post
Gladly - along with theducks response

BR
BetterRed is offline   Reply With Quote
Advert
Old 01-28-2020, 07:12 AM   #66
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by BetterRed View Post
My primary interest is removing the 'experimental/unofficial' versions, and updating the first post with a new 'official' version. Happy to let you make the call as to which one that should be.

What about converting to Py3, should that be done now or later?
Well, in the interests of clearing things up, here's another version!

There are three main changes in this:
  • New: Keep aspect ratio option - Based on code from @gingerbeardman and @Narengil
  • New: Made translatable
  • Update: Changes for Python 3 support in calibre.

As I stated above, I preferred the checkbox method of @gingerbeardman. There are other changes in the code from both versions as I cleaned some things up.

I did the translation as it is fairly easy and there aren't that many strings in the interface. The attached file "default.po.txt" should be renamed to "default.po" and used for the translations. I recommend using a tool such as POEdit to do the editing. If anyone does, please post the translated .po file or PM it to me.

The changes for Python 3 were probably the quickest I have seen for any plugin so far.

If anyone sees a problem, please report it here.

@BR: Give this a few days of testing before release. And in case we get a translation. I have set the version to1.0.6 but would change it to 1.1.0 before releasing.

Last edited by BetterRed; 09-20-2020 at 04:43 PM. Reason: Remove attachments - now in the release
davidfor is offline   Reply With Quote
Old 01-28-2020, 11:16 AM   #67
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Quote:
Originally Posted by davidfor View Post
If anyone sees a problem, please report it here.
Calibre 4.9.1 + 4.99.4

Spoiler:
Code:
Traceback (most recent call last):
  File "plugins.py", line 295, in customize_plugin
  File "plugins.py", line 373, in modify_plugin
  File "__init__.py", line 157, in do_user_config
  File "calibre_plugins.resize_cover.__init__", line 62, in config_widget
  File "calibre_plugins.resize_cover.config", line 213, in __init__
  File "calibre_plugins.resize_cover.config", line 75, in populate_table
  File "calibre_plugins.resize_cover.config", line 86, in populate_table_row
TypeError: string indices must be integers
BeckyEbook is offline   Reply With Quote
Old 01-28-2020, 02:30 PM   #68
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by davidfor View Post
Well, in the interests of clearing things up, here's another version!

There are three main changes in this:
  • New: Keep aspect ratio option - Based on code from @gingerbeardman and @Narengil
  • New: Made translatable
  • Update: Changes for Python 3 support in calibre.

As I stated above, I preferred the checkbox method of @gingerbeardman. There are other changes in the code from both versions as I cleaned some things up.

I did the translation as it is fairly easy and there aren't that many strings in the interface. The attached file "default.po.txt" should be renamed to "default.po" and used for the translations. I recommend using a tool such as POEdit to do the editing. If anyone does, please post the translated .po file or PM it to me.

The changes for Python 3 were probably the quickest I have seen for any plugin so far.

If anyone sees a problem, please report it here.

@BR: Give this a few days of testing before release. And in case we get a translation. I have set the version to1.0.6 but would change it to 1.1.0 before releasing.


Had same thought on the version number.

I've removed the old unnofficial versions

BR

Last edited by BetterRed; 01-28-2020 at 02:35 PM.
BetterRed is offline   Reply With Quote
Old 01-28-2020, 06:52 PM   #69
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by BeckyEbook View Post
Calibre 4.9.1 + 4.99.4

Spoiler:
Code:
Traceback (most recent call last):
  File "plugins.py", line 295, in customize_plugin
  File "plugins.py", line 373, in modify_plugin
  File "__init__.py", line 157, in do_user_config
  File "calibre_plugins.resize_cover.__init__", line 62, in config_widget
  File "calibre_plugins.resize_cover.config", line 213, in __init__
  File "calibre_plugins.resize_cover.config", line 75, in populate_table
  File "calibre_plugins.resize_cover.config", line 86, in populate_table_row
TypeError: string indices must be integers
That seems to suggest that the values in the configuration file are not being seen as numbers. Could you post the plugins config file? This will be "Resize Cover.json" in the plugins directory of the calibre configuration directory.
davidfor is offline   Reply With Quote
Old 01-28-2020, 07:36 PM   #70
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Quote:
Originally Posted by davidfor View Post
That seems to suggest that the values in the configuration file are not being seen as numbers. Could you post the plugins config file? This will be "Resize Cover.json" in the plugins directory of the calibre configuration directory.
Sure.
Spoiler:
Code:
{
  "Options": {
    "sizes": [
      {
        "default": false, 
        "height": 680, 
        "ratio": false, 
        "width": 450
      }, 
      {
        "default": true, 
        "height": 300, 
        "ratio": false, 
        "width": 300
      }, 
      {
        "default": false, 
        "height": 1000, 
        "ratio": true, 
        "width": 1000
      }, 
      {
        "default": false, 
        "height": 450, 
        "ratio": true, 
        "width": 400
      }
    ]
  }
}


I also noticed after running calibre-debug -g

Spoiler:
Code:
Traceback (most recent call last):
File "site-packages\calibre\gui2\ui.py", line 236, in initialize
File "site-packages\calibre\gui2\actions\__init__.py", line 147, in do_genesis
File "calibre_plugins.resize_cover.action", line 48, in genesis
File "calibre_plugins.resize_cover.action", line 67, in rebuild_menus
AttributeError: 'unicode' object has no attribute 'get'


EDIT1: The latter error occurs if you delete the .json file completely.

EDIT2: Additional information: Even if the plug-in starts, creating a new item menu always creates a "Default" item.

Last edited by BeckyEbook; 01-28-2020 at 07:45 PM. Reason: The reason for the error
BeckyEbook is offline   Reply With Quote
Old 01-28-2020, 08:39 PM   #71
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Can we pretend that version didn't exist? I made a really dumb change to the configuration. That flowed through to everything. The attached beta fixes this.

Last edited by BetterRed; 09-20-2020 at 04:44 PM. Reason: Remove beta attachments - now in the release
davidfor is offline   Reply With Quote
Old 01-29-2020, 06:59 AM   #72
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Here is yet another beta. This time with two contributions from @BeckyEbook. These are:
  • Polish translation
  • An option to "Only shrink larger images". If this is set, then only covers that are larger than the size species will be changed. This should be useful if you are resizing the covers to save space.

There is one other change to the alignment of the numbers in the configuration dialog. That they were left aligned bugged me each time I looked at it.

Hopefully this is the last beta.

Last edited by BetterRed; 09-20-2020 at 04:44 PM. Reason: Remove attachments - now in the release
davidfor is offline   Reply With Quote
Old 05-11-2020, 05:22 PM   #73
PapaKilo
Connoisseur
PapaKilo began at the beginning.
 
Posts: 66
Karma: 10
Join Date: Jul 2012
Device: Android, kindle
Another Request

I removed the older version because when I set a Width and Height and keep aspect ratio it always assumes the Width and sets the Height to the calculated value to maintain aspect ratio.

What I would really like is to be able to keep the Height I set and have the plugin change the Width to keep the aspect ratio.

Is this doable?

Could there be an option available to select which would be constant the height of the width.

PapaKilo.
PapaKilo is offline   Reply With Quote
Old 09-20-2020, 09:25 AM   #74
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Update to version 1.1.0

Version 1.1.0 of the plugin has been released. This has support fo the upcoming calibre version 5. Plus changes in the "recent" betas.

The changes in this version are:
  • New: Keep aspect ratio option - Based on code from @gingerbeardman and @Narengil
  • New: Only shrink larger images option - Based on code from @BeckyEbook
  • New: Made translatable
  • New: Polish translation - From @BeckyEbook
  • Update: Right align the numbers in the configuration dialog.
  • Update: Changes for Python 3 support in calibre.

Calibre will announce the availability of the update. If there are any issues, please report them here.
davidfor is offline   Reply With Quote
Old 10-21-2020, 12:57 AM   #75
AMF
Enthusiast
AMF began at the beginning.
 
Posts: 42
Karma: 10
Join Date: Jan 2015
Device: Kobo Glo
Quote:
Originally Posted by PapaKilo View Post
I removed the older version because when I set a Width and Height and keep aspect ratio it always assumes the Width and sets the Height to the calculated value to maintain aspect ratio.

What I would really like is to be able to keep the Height I set and have the plugin change the Width to keep the aspect ratio.

Is this doable?

Could there be an option available to select which would be constant the height of the width.

PapaKilo.
My previous version allowed for this. Sadly the new version fixes the width with no option to fix the height. Can the PI be adapted to do that, please?
AMF is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Goodreads Sync kiwidude Plugins 1722 04-25-2024 03:09 PM
[GUI Plugin] Open With kiwidude Plugins 403 04-01-2024 08:39 AM
[GUI Plugin] Generate Cover kiwidude Plugins 811 03-16-2024 11:31 PM
[GUI Plugin] APNX Generator user_none Plugins 92 10-25-2020 01:24 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 10:34 AM.


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