• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ChordPro and images
#16
Mike, what if we invent a way to embed the image in the ChordPro file?

For example (just a proposal):

Code:
{image id=img1 center}

and at the end of the ChordPro file:

Code:
##image: id=img1 type=jpg width=600 height=84 enc=base64
# /9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEP
# ERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4e
# Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCBMbC7gDAREA
# ...
# EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ
# EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEH//2Q==

MSPro would then only support these type of images, and I think it would be reasonably straightforward for Companion to turn a file link into an embedded image. By 'hiding' the image data within #-comments it will not get in the way of most other tools.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#17
That's certainly an interesting idea. I'm up for trying to support that. So just to verify, you think I should convert any image links to embedded images instead of giving the user control over that, right?  If the relative image link is broken, then I would do nothing when the file is imported or processed.

Thanks,
Mike
Reply
#18
Precisely. And only Companion will have to deal with the actual files. When sending the song file to the device, the file names are gone and the data is included. No tablet editing of filenames that can go wrong, no additional files on the tablet that must be kept track of.

I've made a proof-of-concept implementation in the ChordPro program that seems to work well. It may need another night sleep, though.
Stay tuned.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#19
Okay, this is how far I've got.

The syntax for the {image} directive has a new argument 'id=XXX' that specifies a known asset identified by the id 'XXX'. 'XXX' may be an arbitrary identifier.
For the {image} directive, the asset should be an image.
How the relation from 'XXX' to the image is established is up to the application program.

One way to define an asset is with a special file comment (not to be mistaken with a ChordPro {comment}). Such a comment looks like:

Code:
##image: id=XXX

Minimal, or with all options:

Code:
##image: id=XXX src=im.png type=png width=1341 height=340 enc=base64

which is immedeately followed by the data for the image, base64 encoded, in lines that start with "# " (pound space).

Code:
# iVBORw0KGgoAAAANSUhEUgAABT0AAAFUCAIAAABp2w/aAAAABGdBTUEAALGPC/xhBQAAAER0RVh0
# U29mdHdhcmUAWFYgdmVyc2lvbiAzLjEwYS1qdW1ib0ZpeCtFbmggb2YgMjAwODEyMTYgKGludGVy
... many more ...
# AAd0SU1FB+AEBwgjAAJ9CYIAAAAedEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1QCpgy
# LukAAAAASUVORK5CYII=

So when the user presents a ChordPro file with one or more {image}s, Companion can change the {image} directives and include the image data as shown above. For people that do not use Companion, there are other tools that can assist.

When a song is edited in MSPro, the asset data can be omitted to not clobber the view and/or slow down the editor.

What do you think?
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#20
I think that all sounds great. I'll just have to make sure there are easy ways to add or remove images, especially if I'm hiding the encoded image content from the user in the editor.  It's easy enough to add options for this in the tablet app editor, but the companion app doesn't really have a great editor at the moment for chord pro files. So I will need to start adding more  capabilities. I suppose if I parse the file after the user has edited it and they have removed the ##image line, then I can just remove any image data associated with the given id. So maybe an explicit option to remove an image isn't really needed. Adding an image is as simple as listing the name of the image file to include, so users can either write that themselves or I can add a simple option to add an image that lets them use a dialog to enter the data for the image (so that they don't have to memorize all of the supported parameters).

Thanks,
Mike
Reply
#21
(11-23-2018, 02:02 AM)Zuberman Wrote: I suppose if I parse the file after the user has edited it and they have removed the ##image line, then I can just remove any image data associated with the given id.

I assume you mean "... have removed the {image...} line"? If the user removes an {image} line, the corresponding image data can be discarded (provided it is not used by another {image} line using the same id).

Quote:Adding an image is as simple as listing the name of the image file to include, so users can either write that themselves or I can add a simple option to add an image that lets them use a dialog to enter the data for the image (so that they don't have to memorize all of the supported parameters).

Right.

BTW it still would be possible to put an ChordPro file on the tablet that contains an {image src=...} but then it is completely the responsibility of the user to ensure the image file is also on the tablet, next to the ChordPro file. So w.r.t. files, MSPro would only need to deal with this very trivial case.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#22
Will this cope with multiple images ?
Just playing devil's advocate; I wouldn't use this feature.

Geoff
Samsung Galaxy Tab A6
Reply
#23
You can have multiple {image} directives, hence multiple images.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#24
Hi!

We are currently facing the same topic with our band, so I found this thread. Are there any news regarding that request?
Or is it already implemented and I completely missed it? Big Grin
Reply
#25
I haven't had time to implement it yet unfortunately. It's still on the list of things to do (it's a pretty big list). 

Mike
Reply
#26
The same way we can add text to a PDF, could we imagine adding music notation using ABC notation? We would just type the ABC, and MobilesheetsPro would render the music using abc2svg (preferably as it is more up to date) or abcm2ps. This has several advantages.
  • no need to manage additional image file, only need to save the ABC text, size and position
  • if the chordpro file needs to transposed, we can also transpose the ABC fragment before rendering
  • no need to edit the music in a separate dedicated music writing app/software. ABC is simple text and can be entered in any dumb text editor.

If we want to further integrate with .chordpro file, this could even be added as a .chordpro directive {abc} or section {start_of_abc} {end_of_abc} to allow multi-lines.
Reply
#27
Yes, please.

As it goes, it's an old request of mine, If you want to look in some old threads:

https://zubersoft.com/mobilesheets/forum...p?tid=4906
https://zubersoft.com/mobilesheets/forum...p?tid=4287
https://zubersoft.com/mobilesheets/forum...p?tid=6459

Mike already said he will implement. But it's far behind other projects like iOs support and others.

But the more people request it the higher it gets on Mike's todolist.
Reply
#28
Adding {start_of_abc} and {end_of_abc} to ChordPro is seriously being considered.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Reply
#29
I would also appreciate adding ABC support, it would save me some time and make edits easier.

Tablet: Surface Pro 8, 
Other: Strich BT-FP2, USB-MIDI connection to Kurzweil Forte 7
Reply
#30
Nice idea. I would also appreciate this support Smile (much better than my current approach of exporting the relevant part from a notation program to an image and integrating that, usually into a PDF created by ChordPro Confused )
Holger
Samsung Galaxy Tab A (SM-T580, Android 8.1.0)
Samsung Galaxy Tab A7 (SM-T500, Android 12)
AirTurn Duo
Reply




Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2024 MyBB Group.