Vector databending

Show off your finished Inkscape work.
User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Vector databending

Postby hellocatfood » Wed May 13, 2009 3:53 am

I've been toying around with databending for a awhile now. If you don't know what databending is try opening a copy of a /jpg in a text editor, adding random characters and then saving it as a .jpg again. Or look at this group on flickr. It's like manually causing an error on your images.

Anyway, I've been doing this for a bit and wondered if it's possible with a vector file... it is! Like .jpgs and other raster formats (apart from RAW), vectors have a header declaring what type of file it is, so if you edit that you mess up your vector and it wont open. However, if you cut that bit out you can then edit the file as you wish... kinda. svgs have an almost human-readable structure to them, so the 'bending' can be so chaotic. I've done a few images so far (below) where I've just replaced some numbers - in this instance the number 8 - with other numbers, like 1 and 16.

So, I went from this picture

Image

To this picture in a few clicks

Image

Pretty crazy, right? Have a go on a picture of your own, but remember not to edit the original file! Make a copy of it first. I really like this kind of art, but, like Marmite, you either love it or hate it!
I'm on The Web | Flickr | tumblr

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vector databending

Postby brynn » Sat May 16, 2009 10:32 am

Awesome, I wanna try!
How do you tell where the header stops, so you know what to delete?

[Edit -- I've been searching for tutorials, but have only found one (Basics - Help menu > Tutorials
Manual -
Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: Vector databending

Postby hellocatfood » Mon May 18, 2009 2:28 am

brynn wrote:Awesome, I wanna try!
How do you tell where the header stops, so you know what to delete?

[Edit -- I've been searching for tutorials, but have only found one (

Code: Select all

<layer>
. Cut out the header, edit the code and then paste the header back in.

Lemme know if this doesn't work
I'm on The Web | Flickr | tumblr

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vector databending

Postby brynn » Tue May 19, 2009 4:38 am

Well, I've opened 4 SVG files (images I made with Inkscape) in Notepad, but <layer> is not found in any of them. When I scroll through the doc, I can make a pretty good guess, in general, where the header ends and the rest of the data begins. But I can't tell exactly where it ends. But I'll do some trial and error.

Question -- why do you take the header out, if you're just going to put it back in?
Last edited by brynn on Tue May 19, 2009 5:22 am, edited 2 times in total.

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: Vector databending

Postby hellocatfood » Tue May 19, 2009 5:09 am

Save it as a plain svg.

In the file I've attached you should cut out lines 1 to 14, modify it and then paste back in the header.

If you modify the information in the header, such as the type of encoding, Inkscape wont be able to open it back. For example, in the ones I showed earlier in the thread at first I just replaced every instance of 8 with 1, but that changed the encoding from UTF-8 to UTF-1, which Inkscape couldn't read. So, I took the header out first.
Attachments
drawing.zip
(555 Bytes) Downloaded 261 times
I'm on The Web | Flickr | tumblr

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vector databending

Postby brynn » Tue May 19, 2009 5:25 am

Ok, next problem. When I set up Notepad to e.g. Replace 8 with 2, it takes 100% of the CPU. And I have 1MB RAM As long as I don't touch anything else, it continues to replace 8 with 2. But if I do even something as simple as restoring another program out of the taskbar, it overloads and stops responding. Is that normal for databending? Because these are fairly huge text docs -- 2.1 MB! I guess I'll wait and let it work overnight, or while I go grocery shopping, or something like that.....or maybe I'll look around for a smaller one. Now that I think about it, the original image contains a lot of Spirographs. So maybe I can find something smaller :idea:

[Edit
Save it as a plain svg.

Oh, do you mean not an Inkscape svg?]

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: Vector databending

Postby hellocatfood » Tue May 19, 2009 5:44 am

I find that happens with Notepad as well, but that's why I use Notepad++ (if you have Windows that is). It generally loads faster has a great tabbed interface, plus you can see line numbers and find/replace/count instances of characters easily (just ctrl+F)

Do save as plain svg. When you go to save as just select it from the dropdown menu. I haven't experimented with Inkscape svgs yet, but I'm sure it's not hard, I've just gotta find the time to try it!
I'm on The Web | Flickr | tumblr

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vector databending

Postby brynn » Tue May 19, 2009 9:27 am

Oh gee -- I don't have that kind of text editor. I tried WordPad, just in case, but it's even slower than Notepad! I've been thinking of getting a more substantial text editor. But when I looked at Notepad++ a while back, there was some weird psycho rant posted (I think by the author, if I remember correctly) that scared me off. And I never have finished searching for one that's right for me. So....well I still want to give this databending a try, so I'll have to finish searching for a better text editor.

Thanks for your help hellocatfood :D

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: Vector databending

Postby hellocatfood » Tue May 19, 2009 4:26 pm

Wordpad is an even worse text editor as on loading a document it replaces some characters with its own characters, though it can produce interesting results.

Be sure to post your results!
I'm on The Web | Flickr | tumblr

User avatar
ErikTiePie
Posts: 92
Joined: Fri Nov 21, 2008 10:52 pm

Re: Vector databending

Postby ErikTiePie » Tue May 19, 2009 6:37 pm

brynn wrote:Oh gee -- I don't have that kind of text editor. I tried WordPad, just in case, but it's even slower than Notepad! I've been thinking of getting a more substantial text editor. But when I looked at Notepad++ a while back, there was some weird psycho rant posted (I think by the author, if I remember correctly) that scared me off. And I never have finished searching for one that's right for me. So....well I still want to give this databending a try, so I'll have to finish searching for a better text editor.



You could try Crimson Editor, it's free.

Not free, but in my opinion very good: Edit Plus

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vector databending

Postby brynn » Thu May 21, 2009 9:34 am

Thanks Erik, I'll have a look.
And hellocatfood, I'll be interested to read that article. Thanks.

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Vector databending

Postby chriswww » Tue Nov 30, 2010 12:46 pm

or you can use gvim on windows or macvim on mac. much more power in search/replace when you can use regular expression syntax. you can also easily skip the search/replace for the first few lines, as you can specify the range (of lines or by patterns) for the search/replace.


Return to “Finished Inkscape Work”