Jump to content

Is there a way embed raw image data in script output


Recommended Posts

Posted

I was looking over some HTML that had IMG tags with raw base64 encoded images in them.

 

Is this something alfred supports?

<img  class='imga' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAAbFBMVEVHcEz/zE38uDn0kAz5mxr0kAr0kAv4vT/3oiH2mRb0jwv/zEz0kAv/ykr0jwz0kAv0kAv/zEz/zE3/zEz0kAv/zE30kAxmRQD7riz3mxh0UQathCPKZAbeeQjktD+IYxG5UwWYcRnKnTHVpzilKrAPAAAAFXRSTlMA7lP3C2mr/ho279fYfOXKhqjJjZFWiujLAAADpUlEQVRYw61Y2YKqMAxlaWlBQESpLF4R/f9/vJTuC3UcJy+jaXNyctLGgSgKGE6qU3uIuy4+tKcqwdGvLD8fOssO5/xTFFA5KByrAh/A4Crudi2uflxiEoBhUD+j03ZvrcXf0+Gkknc45+6Hdg7jnLof2+mPcIJIH+EEkM7dh7ajU9J9bN7e4fhzoNh3ntruF9b+SWHe4qzC7tM4jsvTivJ4Y3sYVEbEdGU2o7de6wKD2BdxvY7ondeiZBB6XpXNb7w2JX0e3kct5DoFvXRmGvNZJ7TQlMu02kKDUchLLd+7HOM4yW2v+foMee2LYkx6ZLY86LVqw91Xhr891e7prr4Dqn470PYHXPsdUOtv2uem2hZ/BxRLoO5L2wWal1DYMu8C2aWN1/G1B/NaF3dLs8V+rbdyQV4cOpReu2I77adXfZw8MPTiL/vtdw/kNnzG6W5N7M0bOJDuFRFjbJye97VGdH9OwnMPXBHPpTUHojIPjnZpfWPEj+TD0cbI2raB9NYyml2c2W5lTwZjaJ97QlaXWt5gJ4vU1ke+xmxYw3p91OaIUCSRj36hn5EOxWb2tlFwHraNavhDCA6UEovmQJzfc5rXn+lxnp6KAwfaMEl/ABByHELKSrhFacTRzF4RqauSEIaUrd8LxJP1khLx3BGWTeGstFGx/s2YQAVHGGRJPTHEN8RlucTebWfBZcIlX1dCEW9xvSCEBj2iZAcJ5wBkOr6C7H04+uqGlwGQr1C4JmUeNbz9MtXgysQEEunk5ibKS1Jj2jNSJBFMTaF64sg0cB6GPCmMEqpxQhkR2r+81nk/CLGRBu666fvqfGNCGXGpM4CPLJIG3G48SsnUC8/jn9xGjpjJy+Rmn4VPbSa6TEg6VBKZPRP//kF+GCDf8O8h94riBuWRiw3Xo+EoDWZSU91SBqSSckpIc3C6aSLDcAM3NqtiDPqSpzZ7rlKvOW4cKG+43DQYRhcOuhWbEhdosCqTqymTlvG68PY3kSb1GyCtE1TmRrZfCA/lsqERkePABYKy5ar9JVZIetdCQFAeQrP9Ry97uzQty5FNIKg9YxXEMF0ku2uPm7m3MJ608tJcVVlTRF/7IOIvm9DRYT6vZTuUiq1+UHg7KmQ27EK8ivLz3/gJXXxPxzAlrpW8IaD0LKZw5x1W7W6VCuRumnr3/RY+7uJ4kI6Bdz/gEuiI1dlL+B2ZdiqLxtoKmkI7i+/f9jVZXRRlBj0ZAczKoqizxoX5Dy1+Rl/3Iv1GAAAAAElFTkSuQmCC'></td>
Posted

What are you trying to do exactly?

 

I mean, sure, you can output base64-encoded data. It's just ASCII text after all. But that's probably not what you mean.

Posted

Instead of having 

image='image.png'

in your workflow script i'm wondering if i can just put raw base64 text in there - if for some reason i wanted to programmatically generate the icon or something like that.

 

And then alfred would make it look nice without having to use an external icon link.

Posted

Certainly not possible yet.

I think specifying an image URL might be possible at some point in the future, but I'm not sure if inline images will.

In browsers, inline images and fonts cut down on network requests, but I suspect it would make workflows quite a bit slower. If you were going to cache the images instead of regenerating them each run, you'd save the actual image, and inline images would massively bloat the JSON.

As a rule, Andrew doesn't add features that make Alfred slower or use significantly more resources.

When I generate images programmatically, I stick them in the cache directory using a file name based on the generation parameters.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...