# expanding 2D matrix by fraction

Discussion in 'General Electronics Chat' started by aamirali, Jul 24, 2013.

1. ### aamirali Thread Starter Member

Feb 2, 2012
415
1
I have image store in 2D matrix. i.e for each address of TFT I have which bit is set & which is zero.
Consider image as black & white, 1 means pixel on & 0 means pixels off. So i have all the values in 2D matrix.

Now I have to expand this array while printing, this is expansion is both on x & y axis. Like on x axis it should be 1.25 times the original & on y it should be 1.5 times.

How to do that in best way

2. ### WBahn Moderator

Mar 31, 2012
17,716
4,788
There are a number of ways to do it and various methods produce better quality results for different types of images. So it is very much a function of the type of image is being represented and what type of information is most important to retain in the scaled up image.

3. ### aamirali Thread Starter Member

Feb 2, 2012
415
1
I have to print small graph/values/text only. Even if some bits are lost (but not many) it won't affect

4. ### WBahn Moderator

Mar 31, 2012
17,716
4,788
The quickest and easiest way (and the one that will likely give you the poorest results, but if they are good enough, they are good enough) would to simply repeat every 4th column and every other row. So you might try that and see if it is acceptable.

5. ### aamirali Thread Starter Member

Feb 2, 2012
415
1
that would not work as I have to show graph. which is part of image.
Can u plz point some links/another algo

6. ### WBahn Moderator

Mar 31, 2012
17,716
4,788
Why would that not work? Try it and see. What does it do that is unacceptable? Often time the way to find a suitable approach is to try approaches that you expect to be unsuitable and examine them closely to find out why they are unsuitable.

Remember, this is YOUR problem. Don't expect others to do all of your work for you.

7. ### MrChips Moderator

Oct 2, 2009
12,423
3,359
What computer platform and language are you using?
Matlab has functions to do this.

8. ### sirch2 Well-Known Member

Jan 21, 2013
1,008
351
If all you have is a mono-chrome bitmap then short of line-tracing the graph to create a vector representation of it, all you can sensibly do is repeat the previous pixel.

It would be better to alter whatever creates the graph to give you the correct image resolution in the first place.