batman_da_salada 32 #1 Posted March 27, 2010 (edited) Ok propaganda enganoza! em teoria deveria funcionar mais na pratica nao funfou :fuu: :fuu: :fuu: Eu usei GD lib pra cirar um programa que pega 2 bytes e transforma em uma cor e coloca na foto. Bem eu fiz, o arquivo nao se corrompe ele vira uma foto, so que na foto vc pode colocar de 1 a 3 bytes, e a variação entre essas 3 bytes resulta cor, ai pensei, bem uma cor deve ser 1 byte entao posso pegar até 3 bytes e transformar em 1 OMG! nao deu, pq se vc poe 3 bytes em uma cor a cor fica ocm 3 bytes (PQP JURA?) em fim ai meu code fail :fail: : --Compactador by mock require("gd") local q = io.open('brush.lua','rb') file = q:read(-1) q:close() local size = file:len() local lem = 1 if size/2 ~= math.floor(size/2) then size = math.floor(size/2)+1 else size = math.floor(size/2) end im = gd.createTrueColor(size,1) print(size/2,math.floor(size/2)) y=1 for x=1,size do --if lem+1 > file:len() then --c = im:colorAllocate(0xff,0xff,0xff) --else l3 = 0 if lem <= file:len() then l1 = file:sub(lem,lem):byte() else l1 = 0 l3 = 200 end if lem+1 <= file:len() then l2 = file:sub(lem+1,lem+1):byte() else l2 = 0 if l3 == 200 then l3 = 255 else l3 = 200 end end c = im:colorAllocate(l1,l3,l2) --lem = lem+1 lem = lem+2 if im:setPixel(x-1, y-1, c) then print('af',c,x-1,y-1) end ca = im:getPixel(x-1, y-1) if c ~= ca then print(c,ca) break end end assert(im:png("./aee.png",0),'q') Descompactador: --by mock im = gd.createFromPng("./aee.png") size = im:sizeX() local v = '' local lena = 0 y=1 for x=1,size do local c = im:getPixel(x-1, y-1) --.. --print(c) local s2 = string.char(im:blue(c)) local r = string.char(im:red(c)) if im:green(c) ~= 255 then lena = lena+1 else --print(im:red(c),im:blue(c)) end if (im:green(c) == 255 or im:green(c) == 200) then r = '' end if (im:green(c) == 255 or im:green(c) == 100) then s2 = '' end v = v..r..s2 end print(file:len()) print(v:len()) io.open('brusha.lua','wb'):write(v) Ai ele cria fotos ai as fotos sao assim: Ampliando pra ver melhor: o code ta super bagunçado, to nem ai '-' Edited January 23, 2011 by Mickfern Share this post Link to post Share on other sites
Dean 1 #2 Posted March 27, 2010 o.O Deu pra compactar 70% aqui. Share this post Link to post Share on other sites
Roku 0 #3 Posted March 27, 2010 Tipo pra que serve isso? PS: notei o troço lá de editar arquivos binários =] Share this post Link to post Share on other sites
batman_da_salada 32 #4 Posted March 27, 2010 @Iurimandello sim ele compacxta 50% do arquivo em si, so que em disco ainda fica o tamanho autal. Share this post Link to post Share on other sites