Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 21 Apr 2014, 00:13
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Pikona - Puppy Icon Assembler NEW and TINY! - v.0.4e
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 4 [55 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 28 Aug 2010, 16:06    Post subject:  

Hey vovchik


I know this was working correctly on slaxer_pup
but I upgraded bash to version 4.1 on TXZ_pup
and for some odd reason it wont save the image

I want to use this to make a logo

I think that the pikona bin may have to be recompiled
the app comes up fine but it doesnt save the image
Im puzzled of what you need to recompile this
and if HUG as to updated too

thanks in advance friend
Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 28 Aug 2010, 17:14    Post subject:  

Dear Joe,

Let me try to compile it in Puppy 4.10 or in Lucid and see what happens. HUG has changed a bit (some calling conventions), as has Bacon, so I think I should use the old HUG (last one that worked), since it did what I expected it to do. I'll experiment. Lucid has bash v. 4.1.5, and bacon compiled fine with that a few days ago, although I didn't experiment with HUG in that setting. Try grabbing the latest bacon.bash and bacon.bac from Peter's site and compile it. Then try compiling Pikona using the bacon binary, once with a new HUG and once with the old. I wonder whether the saving doesn't have something to do with write permissions in the place that Pikona might be installed. Just and idea.

With kind regards,
vovchik

UPDATE: I compiled pikona in Lucid and it saves. I had to use the old hug because the IMAGE command syntax changed and I haven't yet changed my source. But with the old hug it saves to the icn dir. What is important is that you use your IM, because the one in Lucid seems to screw up the alpha channel (renders it black). I suppose that could be fixed by also looking at changes in IM convert syntax. Sad
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 28 Aug 2010, 19:24    Post subject:  

Quote:
Try grabbing the latest bacon.bash and bacon.bac from Peter's site and compile it. Then try compiling Pikona using the bacon binary, once with a new HUG and once with the old. I wonder whether the saving doesn't have something to do with write permissions in the place that Pikona might be installed. Just and idea.


well I figured out how to compile the bacon (that sounds funny) Very Happy
then the pikona with HUG

main page
http://www.basic-converter.org/

a mini how to of what I did


*************************
1.)download bacon bash
make it executable

2.)download bacon bac

3.)then compile it like this

---------------------------
Code:
 ./bacon.bash bacon.bac

--------------------------
this is quite strange to compile the bacon bac by using the bacon bash
but thats what you do


this takes awhile and generates many files then they are deleted and only
the bin remains called bacon

-------this is the actual command ----------------
#
Code:
  ./bacon.bash bacon.bac

Starting conversion... done.
Starting compilation... done.
Program 'bacon' ready.

#

now compile pikona

#
Code:
./bacon.bash pikona.bac

Starting conversion... done.
Starting compilation... done.
Program 'pikona' ready.

#

still having a problem with the save file Confused

so I 'll try again compiling this on a clean system
puppy pfix=ram
bbl
Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 28 Aug 2010, 21:43    Post subject:  

Very Happy Very Happy Very Happy

all worked using your original app on a clean install
I have no idea what went wrong but the good news is it works as is

and the better news is I got the logo



made a TXZ package too and included a menu item and a launch script so the icons come up when the program is launched from the menu
http://www.puppy2.org/slaxer/pikona-001a-i486-3_SLXR.txz


thanks
Joe
x-xz_clear.png
 Description   
 Filesize   19.54 KB
 Viewed   1580 Time(s)

x-xz_clear.png


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Tue 09 Nov 2010, 08:55    Post subject:  

Vovchik, did you consider using 'netpbm' instead of ImageMagick?

Puppy already has many of the netpbm utilities builtin.

Here is an overview of the utilities:

http://netpbm.sourceforge.net/doc/directory.html

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 09 Nov 2010, 09:57    Post subject: future pikona mod  

Dear Barry,

I have thought of several things in order to remove the IM dependencies. MU once posted three little utilities he wrote in c (each of which is about 4k compiled) that would do the job, except that one of them - scale2png - screws up when it comes to the alpha channel at high bit depth. The code is tiny, so I should look at it and try to do a rewrite in BaCon or use the modded c code directly (BaCon allows for that as a USEC). I would just have to get the IMPORT stuff straightened out, since these CLI progs make use of GTK (mainly gdk_pixbuf). I have already written a tiny bit of test code that is CLI but uses the GTK libs, so I think I can manage. What I would really like is totally self-contained code - apart from shared libs that are available on each and every Puppy (X11, GDK, GTK). I will look at netpbm, too. Ideally, the graphic transformations should all take place within Pikona (in RAM). It would make the program much faster and prevent dependency hell.

I have attached Mark's source for the utilities that could, with a bit of reworking, replace IM. They were part of his Scale2pics package and have nice potential.

With kind regards,
vovchik
source.tar.gz
Description 
gz

 Download 
Filename  source.tar.gz 
Filesize  5.44 KB 
Downloaded  433 Time(s) 
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Tue 09 Nov 2010, 11:07    Post subject:  

Hey vovchik
thanks for posting the source .There is one more needed scale2png.c

that wasnt in the source there was only the bin .Here it is the "make" is the same



I'll post it here
Joe

Quote:
MU once posted three little utilities he wrote in c (each of which is about 4k compiled) that would do the job, except that one of them - scale2png - screws up when it comes to the alpha channel at high bit depth.





char *quality = "75"; what would happen if that was 100 ?


unedited original source
call it scale2png.c




Code:
#include <gdk/gdkx.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

GdkPixbuf *im , *im2;


int main(int argc, char **argv) {

 gdk_init(&argc,&argv);

  char *thefile;
  char *outfile;
  char *theheight = "20";
  char *thewidth = "20";
  char *quality = "75";

 

  if ( argc == 1 ){
    return 1;
  }
 

  thefile = argv[1];
  outfile = argv[2];
  thewidth = argv[3];
  theheight = argv[4];
  quality = argv[5];

  float theight = atoi(theheight);
  float twidth = atoi(thewidth);

  char newquality[1024];
  float q=atoi(quality);
  float newq=100-q;

  int q2=newq/10;
  sprintf(newquality ,"%d" , q2);
 //printf("quality: %s\n" ,newquality);

  char roxpic[1024];
  sprintf(roxpic , "%s" , outfile);

// printf("option: %s\n" ,option);
 

  char jpgname[1024];

  sprintf(jpgname,roxpic);
  int zoom_quality = (int)GDK_INTERP_HYPER;

  im2 = gdk_pixbuf_new_from_file ( thefile , NULL);


float w=0;
float h=0;
float rx=0;
float ry=0;
int neww;
int newh;
int newx=0;
int newy=0;

  w=gdk_pixbuf_get_width(im2);
  h=gdk_pixbuf_get_height(im2);

  rx=twidth / w;
  ry=theight / h;


if(theight==twidth){
     neww=twidth;
     newh=theight;
}else{
   if(rx <=ry){
     neww=twidth;
     newh=h*rx+1;
     //newy=(theight/2)-(newh/2);
   }else{
     neww=w*ry+1;
     newh=theight;
     //newx=(twidth/2)-(neww/2);
   }
}



  im = gdk_pixbuf_scale_simple(im2, neww , newh, (GdkInterpType)zoom_quality);

  gdk_pixbuf_save ( im , jpgname , "png" ,NULL, "compression" , newquality, NULL);


  gdk_pixbuf_unref(im);
  gdk_pixbuf_unref(im2);   

//gdk_flush();

printf("%d\n%d\n", neww , newh);

  return 0;

}


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 09 Nov 2010, 13:45    Post subject: good news - bad news  

Dear Joe,

The intermediate news is that I am almost finished porting scale2png.


The good news is that:
Code:

quality = "100"
q = VAL(quality$)
newq = 100 - q
q2 = newq / 10
PRINT q2

does not generate a "division by zero" error. Smile

The bad news is that it generates a value of "0". Sad

But the prog does not stop and keeps going.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Thu 11 Nov 2010, 00:45    Post subject:  

if we had some real values to substitute "print out" to verify that all reduces down to a very simple math equation Idea

------------------------------------------------------

aaphoto is a pre compiled bin but guess what here is the source Very Happy

--png *PNG image output with alpha channel support

http://aaphoto.sourcearchive.com/documentation/0.38-2/files.html
http://aaphoto.sourcearchive.com/documentation/0.38-2/aaresize_8c-source.html

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Thu 11 Nov 2010, 12:00    Post subject: Picscale 0.1a - updated
Subject description: First stab at an image converter in Bacon
 

Dear Puppians,

With the kind assistance of Peter (www.basic-converter.org), I got a first"draft" of picscale working in BaCon. If anybody has suggestions on how to improve the quality of the jpg conversion, please let me know. A binary and source are in the archive.

With kind regards,

PS. I think I am moving towards an ImageMagick-free Pikona. All I now need to do is to figure out how to use gdk_pixbuf to overlay images. Dammit, it looks like I will, at long last, have to consult the documentation. Smile

UPDATE: I updated the archive since I fixed the bad jpg rendering and cleaned up the code a little bit.

UPDATE2: In fixing the jpeg quality stuff, I managed to destroy png transparency. It is now fixed and the archive has been updated. Sorry about that. Sad
picscale.tar.gz
Description 
gz

 Download 
Filename  picscale.tar.gz 
Filesize  14.87 KB 
Downloaded  760 Time(s) 
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 12 Nov 2010, 11:54    Post subject:  

Hey vovchik

That was fast converting all that c code into BaCon!!

I am trying to follow what you did so I can figure out whats going on between c code and Bacon coding

these are some notes and questions I have

since this is a major move ahead to port to BaCon a heavily commented
first draft version is very welcomed


1.) the original code scale2png.c was small but not well commented at all so an abstract math equation for me because of not having a known value for w and h and other values

which makes the logical part of the rx and ry obscure

*I like how you made the variables clearer to read



I dont understand the less than or equal to in the ELSE
IF r_x<=r_y

I would hope for a check for less than --- then a condition
or an equal to --- then a condition
for debugging to see what value you get

I like how you did this part could you add (for debugging verbose )

---------------------------------------------------

' -----------
SUB REPORT_RESULTS()
' -----------
IF FILEEXISTS(new_file$) THEN
PRINT "File ", new_file$, " created."
PRINT "Original image: ", org_file$
PRINT "New dimensions (w x h): ", new_width$, " x ", new_height$
PRINT "Quality of new image: ", quality$
PRINT "Verbose debugging info below "
PRINT "r_x =:",r_x$
PRINT "r_y =:",r_y$
PRINT "h =:",h$
PRINT "y =:",y$
PRINT "q =:",q$
PRINT "q2 =:",q2$
PRINT "new_quality =:",new-quality$
PRINT "new_q =:",new_q$
PRINT "t_height =:",t_height$
PRINT "t_width =:",t_width$



ELSE
PRINT "OOPS.. something terrible happened and ", new_file$, " was not created."
END IF
gtk_exit(0)
END SUB
---------------------------------------------------

3.) the IMPORTS need to be explained well commented how that was done


4.) what is very interesting is how the c part
of the code changes very little in the conversion except for the complex import part Very Happy

thanks for all your work on this I will learn a lot from it

*maybe another simple c code example with imports( for one trying to learn)
then ported to BaCon

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 12 Nov 2010, 13:23    Post subject:  

two small scripts to get started with BaCon



Code:


#!/bin/bash


# Joe Arose  big_bass 11-14-2010
# call the auto-build-compile-bacon
# auto download compile install  and test Bacon and the 18 basic examples
# so you can easily update when needed


Xdialog --wrap --title "bacon instlaller" \
        --yesno "Do you want to install bacon  " 0 0

case $? in
  0)
    echo "Yes chosen."
   


rm -f  bacon.bash*
rm -f  bacon.bac*
rm -f  bacon

xterm  -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bash
chmod a+x bacon.bash


xterm  -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bac
chmod a+x bacon.bac


xterm  -geometry 40x30+150+40 -e ./bacon.bash bacon.bac

# copy bacon bin into the path
cp bacon /usr/sbin


Xdialog --title "Complete" \
           --infobox "\nInstalling bacon has finished.\n" 0 0 3000


   ;;
  1)
    echo "No chosen."
    exit
   ;;
  255)
    echo "Box closed."
    exit
   ;;

esac






Xdialog --wrap --title "test bac downloader" \
        --yesno "Do you want to download the bac examples   " 0 0

case $? in
  0)
    echo "Yes chosen."
   

# download and compile the 18  starter test files

###########################################
clean up old projects
rm -f  /root/bacon-examples/test*

cat << 'EOF' >/tmp/basic-examples
test1.bac
test2.bac
test3.bac
test4.bac
test5.bac
test6.bac
test7.bac
test8.bac
test9.bac
test10.bac
test11.bac
test12.bac
test13.bac
test14.bac
test15.bac
test16.bac
test17.bac
test18.bac
EOF

mkdir -p /root/bacon-examples
cd /root/bacon-examples  #note if not done it goes to root directory
MYURL="http://www.basic-converter.org/"


for i in `cat /tmp/basic-examples`
do xterm  -geometry 40x30+150+40 -e wget -c $MYURL$i


xterm  -geometry 40x30+150+40 -e bacon /root/bacon-examples/$i
Xdialog --title "testing compiler " \
           --infobox "\n$i compiled with bacon .\n" 0 0 3000


BAC_BIN=`basename  "$i" .bac`
xterm -hold  -geometry 40x30+150+40 -e /root/bacon-examples/$BAC_BIN

done
   ;;
  1)
    echo "No chosen."
    exit
   ;;
  255)
    echo "Box closed."
    exit
   ;;

esac





Code:


#!/bin/sh

# call this dnd-bac-compiler

# a drag N drop bac  compiler    just drag N drop any *.bac file on the 
# script to compile it to a binary
# run the binary by opening a terminal ./name of the binary

xterm  -geometry 40x30+150+40 -e bacon "$@"

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Mon 15 Nov 2010, 11:59; edited 4 times in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 12 Nov 2010, 18:29    Post subject: comments and source  

Dear Joe,

Thanks for the nice words. I have ported a few c examples and they are on Peter's site. I also have my original c sources so I can post them here. I will try to annotate my code (IMPORTS mainly), but I got those from studying the gtk/gdk/glade calls, looking at Peter's nearly complete gtk.bac and gdk.bac and glade.bac files and, in a few cases, winging it after looking at the var types needed by the calls. It becomes easier after a few "iterations" and you get a feel for it after few successes. I have an entire directory of c gtk gui samples and forced myself to translate a number of them to BaCon. It was a good exercise and, when I got stuck, I asked Peter, who knows all there is to know about BaCon and GTK (he also wrote GTK-server). If you get stuck, just holler Smile Mechanic (Doyle) is doing a lot of gtk stuff in baCon and can provide some guidance.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 11 Mar 2011, 13:20    Post subject:  

Hey vovchik

I am making a personal wish list for the next pikona


http://gnome-look.org/content/show.php?content=128143&forumpage=35&PHPSESSID=de867fec9c932cf6509004c0def5547c

there is no template to make those .......yet
if you could have a template for faenza_icons
with a rounded corner thin squared glass overlay
many new icons could be made

thanks

I wanted to bump this thread again too Very Happy
Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 11 Mar 2011, 14:03    Post subject: Faenza stuff  

Dear Joe,

I am looking at the Faenza stuff now. It should be possible, so I will give it a try.Smile

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 4 [55 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1023s ][ Queries: 13 (0.0069s) ][ GZIP on ]