I'm trying to show some text overlay but I need it to be bigger than size 24. the problem is I can't find a way to do that!
At the moment I'm using:
GLvoid *font_style = GLUT_BITMAP_TIMES_ROMAN_24;
How can I increase the size of it? (it's no problem if I need to change to something else other than times roman)
Try render the text with FTGL instead. You will get higher quality text and more flexibility.
(For normal font sizes, use the FTGL texture fonts. For large font sizes, use the FTGL vector fonts. For size 24 you should probably use the texture fonts.)
Related
Lets say I am creating an icon in illustrator, which should be saved as an svg. If I create a large nice vector icon, lets say 800x800 pixels, I can always scale it as I want to, and its "easier" to work with. Problem is, when this icon is saved, the file size is big.
If I instead make a small icon in illustrator, on a document size which has the proportions the icon will be used as, lets say 20x20, the file size is much smaller.
So what is good practice when working with icon sizes?
Thanks!
You are mistaken. A vector graphic that is 800x800 should have the same file size (more or less) as a vector graphic that is 20x20. That is because the shapes that make up the file are defined "mathematically" and can be rendered at any size.
If your files have significantly different sizes, you have probably not created a purely vector file. It probably has bitmap images in it. Bitmap image file sizes are greater if the image size is larger.
However, in answer to your primary question, it doesn't really matter what the page size is when creating vector icons. They could be either of the two sizes you mentioned. Or any other size. Whatever dimensions you choose, they should be rendered nicely at any final size you need.
I'd like to improve the magnification of images (*.png) when they are exported in gnuplot. I had tried to increase the pixels of these images but when they are zoomed too many times, the quality is so bad. So could you please help me for this case.
Here are my commands for exporting the images *.png in gnuplot:
set term pngcairo transparent enhanced lw 2.2 \
font "Century,20" fontscale 1.2 size 1642,1140"
The problem you are facing is not related to gnuplot but to the bitmap nature of png images. Since these images are not vectorial, when you "zoom in" you simply increase the bit size, but not the resolution. The only way to solve this problem is to export to eps instead of png. There are a few terminals in gnuplot that you might be interested in. In my opinion the most powerful is the epslatex terminal: have a look at the documentation with help epslatex.
As mentioned by Miguel, likely the source of your problem is that by exporting a PNG you are exporting an array of pixels. When you zoom in you will start to see the individual pixels of your image.
Probably the best way to solve your problem is to export to some form of vector graphics. Take a look at EPS (side note: most journals will prefer if you submit a vector graphic rather then a PNG).
If you are certain you want to use PNG you should take a look at https://stackoverflow.com/a/9118990/2372604 which mentions changing your terminal to pngcairo to produce smoother results.
Another note to make, if your function is particularly noisy, you may need to increase the number of sample points, consider the command set samples 1000.
Besides the other answers, here are two other options:
increase terminal size (say 4000x3000), until you got something that looks good enough. PNG format is compressed so if most of the plot is white, it won"t add much bytes.
As already said, use a vector graphics format as terminal. The others suggest EPS, but is less common today than svg. The SVG terminal produces .svg files that can be easily post-processed with a tool such as Inkscape.
I have a PNG-Image with alpha values and need to reduce the amount of colors. I need to have no more than 256 colors for all the colors in the image and so far everything I tried (from paint shop to leptonica, etc...) strips the image of the alpha channel and makes it unusable. Is there anything out there that does what I want ?
Edit: I do not want to use a 8-bit palette. I just need to reduce the numbers of color so that my own program can process the image.
Have you tried ImageMagick?
http://www.imagemagick.org/script/index.php
8-bit PNGs with alpha transparency will only render alpha on newer webbrowsers.
Here are some tools and website that does the conversion:
free pngquant
Adobe Fireworks
and website: http://www.8bitalpha.com/
Also, see similar question
The problem you describe is inherent in the PNG format. See the entry at Wikipedia and notice there's no entry in the color options table for Indexed & alpha. There's an ability to add an alpha value to each of the 256 colors, but typically only one palette entry will be made fully transparent and the rest will be fully opaque.
Paint Shop Pro has a couple of options for blending or simulating partial transparency in a paletted PNG - I know because I wrote it.
I am making game for mobile phone and i have little knowledge of creating graphics for games. I am making graphics using CorelDraw & Photoshop.
I made flash.png using above 2 software's & could squeeze the size to 47Kb only.....
But I came across one game which has file size just 2kb for its background (bg0 & bg1.png)
I want to know how do I make such beautiful graphics without increasing the size of my file...
I assume the gamer must have hand sketched, scanned & used one of the above software's to fill the colors.....but i am not sure about it...
plz help
There are several ways to reduce the size of a PNG:
Reduce the colour depth. Don't use RGB true/24 bit colour, use an indexed colour image. You need to add a palette to the image, but each pixel is one byte, not two.
Once you have an indexed colour image, reduce the number of colours in the palette. There is a limit to how many colours you can reduce it by - the fewer colours, the lower the image quality.
Remove unnecessary PNG chunks. Art packages may add additional data to the PNG that isn't image data (creation date, author info, resolution, comments, etc.)
Check http://pmt.sourceforge.net/pngcrush/ to get rid of unneeded PNG chunks and compress the IDAT chunk even further. This might help a lot or not at all depending on the PNG that came out of the art packages. If it doesn't help, consider index PNGs. And if you go for paletized PNGs be sure to check out http://en.wikipedia.org/wiki/Color_cycling for cool effects you might be able to use.
Use a paletted png with few colors and then pass the png through a png optimizer like the free exe PngOptimizer
If your png still is too big reduce the number of colors used and reoptimize. Rince and repeat ^^.
I have used this technique on quite a lot of mobile games where size was of the essence.
I am using ImageMagick to programmatically reduce the size of a PNG image by reducing the colors in the image. I get the images unique-colors and divide this by 2. Then I assign this value to the -colors option as follows:
variable = unique-colors / 2
convert image.png -colors variable -depth 8
I thought this would substantially reduce the size of the image but instead it increases the images size on disk. Can anyone shed any light on this.
Thanks.
EDIT: Turns out the problem was dithering. Dithering helps your reduced color images look more like the originals but adds to the image size. To remove dithering in ImageMagick add +dither to your command.
Example
convert CandyBar.png +dither -colors 300 -depth 8 smallerCandyBar.png
Imagemagick probably uses some dithering algorithm to make image appear as though it has original amount of colors. This increases image data "randomness" (single pixels are recolored at some places to blend into other colors) and this image data no longer packs as well. Research further into how the convert command does the dithering. You can also see this effect by adding second image as a layer in gimp/equivalent program and tuning transparency.
You should use pngquant for this.
You don't need to guess number of colors, it has actual --quality setting:
pngquant --verbose --quality=70 image.png
The above will automatically choose number of colors needed to match given quality in the same scale as JPEG quality (100 = perfect, 70 = OK, 20 = awful).
pngquant has substantially better quantization algorithm, and the better the quantization the better quality/filesize ratio.
And pngquant doesn't dither areas that look good without dithering, and this avoids adding unnecessary noise/randomness to the file.
The "new" PNG's compression is not as good as the one of the original.