![]() |
#1 |
Member
![]() Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
Wrap in SVG plugin?
Hi,
Currently I'm using "Add Cover" tool to wrap my images in SVG. But it is quite a work doing all images one by one. It would be very nice if there was a plugin which allows us to right click an image and choose option "Wrap in SVG", as discussed here: https://www.mobileread.com/forums/arc.../t-215664.html Thanks |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
I am actually thinking about that, but I think that the plugin system is not fit for that.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
These choices do limit what plugins can do. But something like this might not be a bad idea for including as part of Sigil itself. My gut feeling (not really having looking into this much) is a clip that uses a regex to wrap an image in SVG would be the best way to go. It might be a good example clip for us to add. |
|
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
The issue with a regex or clip, is that the dimensions of the image must be adjusted based on the actual image. That cannot be retrieved by a regex or clip. |
|
![]() |
![]() |
![]() |
#5 | |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
* SVG wrapped images I should say |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,247
Karma: 57979022
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
I currently 'walk' a cover leaving behind SVG wrapped IMG code. It is tedious deleting the 2 symantics so I could do the next cover ![]() |
|
![]() |
![]() |
![]() |
#7 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,980
Karma: 5449552
Join Date: Nov 2009
Device: many
|
Hi,
Actually, you could do something like this in a plugin as well. You just could not tie it to the right click menu. Instead you would invoke an SVGImgWrapper edit plugin which pop up a gui list of all of the images it finds in the book, and you simply check which ones (or all) you want to wrap. It would then walk all of the html files and applying the wrapping where needed. Not as nice as your right click approach but doable I think, unless I am missing something. KevinH |
![]() |
![]() |
![]() |
#8 |
Member
![]() Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
I agree, it doesn't have to be right click. Just some less hassle way to wrap images in SVG.
|
![]() |
![]() |
![]() |
#9 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 673
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Or, adding it as an option under "Insert": "insert image as SVG". In fact, "Add a a cover" would also be better under that head than the grab-bag "Tools" heading. For a while I was adding full-page images by "adding a cover" and then found it overwrote the "real" cover file and tagged the new image as the cover. (I wasn't aware of the semantic tags until then.) So it ended up being less hassle to just do it by hand than clean up the mess. |
|
![]() |
![]() |
![]() |
#10 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,980
Karma: 5449552
Join Date: Nov 2009
Device: many
|
Hi,
If you want this feature any time soon, I would suggest a python plugin. If you can show me the before and after html, I can create a plugin that will wrap all images with the desired svg code and not have it add a cover semantics. KevinH |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
rubeus has developed a more advanced version that you can download here. Please download his version unless you're using an older Sigil version and/or Python 2.7.x.
With the help of KevinH, who gave me some extremely helpful pointers, I've created a very simple proof-of-concept plugin that duplicates the functionality of Tools > Add Cover but doesn't touch the existing cover or the guide section. Usage: 1. Install the plugin as usual. 2. Select Plugins > Edit > SVGWrapper > Start. 3. Click the arrow of the dropdown box, select an image and click Insert. 4. Repeat step 3 until you've added all the desired images. 5. Click Done to close the Insert Image dialog box and OK to close the Plugin Runner dialog box. Known issues: 1. The Book Browser won't be updated if you click the Insert button, but the plugin will write a xxx.xhtml added message to the Plugin Runner window. (The Book Browser will be updated when you click Done.) 2. You can't select the location or the name of added images. (Each image will be added at the beginning of the book using the image name as the file name.) Credits: This plugin uses code originally developed by the KindleUnpack developers. Last edited by Doitsu; 12-21-2015 at 05:26 AM. Reason: Uplodaded Python 3 & Sigil 0.8.9 compatible version |
![]() |
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Cool! Good work.
I know it was probably easiest when re-using the KindleUnpack code, but keep in mind that most of the functions provided by utf8_utils.py and path.py are already available in the plugin framework via "compatibility_utils.py" and "unipath.py" respectively. No need to root them out and change them in this case since they just work, but something to keep in mind for the future. ![]() |
![]() |
![]() |
![]() |
#13 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,980
Karma: 5449552
Join Date: Nov 2009
Device: many
|
Hi Doitsu,
Nicely done! As DiapDealer mentioned, if it would make things easier you might want to simply copy the get_image_size routine out of mobi_cover.py and paste it as a routine in your plugin.py and then remove all of the utf8utils, path.py, and mobi_cover.py so you don't have to keep those pieces around. KindleUnpack (we) found that particular routine online in gpl, lgpl, and bsd versions so if you extract it you can pretty much claim any license you want for your code since you would not need anything else from KindleUnpack. Thanks so much for your plugin! I will add it to the sticky list of plugins unless DiapDealer beats me to it! KevinH |
![]() |
![]() |
![]() |
#14 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,980
Karma: 5449552
Join Date: Nov 2009
Device: many
|
Hi All,
I have added Doitsu's latest plugin and my SanityChecker to the Sigil Plugin Index and cleaned it up a bit and added the short description from the plugin.xml for each. Please let me know if anyone else has posted plugins that need to be added to the Sigil plugin index. Thanks! KevinH |
![]() |
![]() |
![]() |
#15 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Quote:
![]() |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
I need help with text wrap... | skammer1974 | Sigil | 3 | 03-06-2013 07:28 PM |
TEXT WRAP AROUND IMAGES | RKEP71 | Sigil | 1 | 06-20-2011 08:26 PM |
Image wrap test | Jellby | ePub | 15 | 05-04-2011 02:30 PM |
LRF and wrap-around text | Seabound | Calibre | 13 | 12-28-2008 03:30 PM |