[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

resizing images

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 6
Thread images: 2

Anyone know a way to resize images without anti-aliasing or whatever its called?

I got one of those mass resizers to make pixel art larger but it automaticaly does the fucking anti-aliasing and makes it all blurry.

Is there a way to do this outside of scaling them all up individually in Paint?
>>
Write your own using nearest pixel algorithm. Extremely trivial.
>>
>>57968731
its called linux
>>
File: nneighbor01.png (4KB, 497x184px) Image search: [Google]
nneighbor01.png
4KB, 497x184px
"antialiasing"
i mean, come on, even a quick google search sould tell you that it isn't antialiasing.
image resizers can use whatever method they want. usually it's lancoz, bicubic, bilinear, and nearest neighbour. the latter is the fastest and it's what you want. this website contains two scripts for it http://tech-algorithm.com/articles/nearest-neighbor-image-scaling/ but since you're too lazy to use google, you fucking manchild, here you fucking go:
 public int[] resizePixels(int[] pixels,int w1,int h1,int w2,int h2) {
int[] temp = new int[w2*h2] ;
// EDIT: added +1 to account for an early rounding problem
int x_ratio = (int)((w1<<16)/w2) +1;
int y_ratio = (int)((h1<<16)/h2) +1;
//int x_ratio = (int)((w1<<16)/w2) ;
//int y_ratio = (int)((h1<<16)/h2) ;
int x2, y2 ;
for (int i=0;i<h2;i++) {
for (int j=0;j<w2;j++) {
x2 = ((j*x_ratio)>>16) ;
y2 = ((i*y_ratio)>>16) ;
temp[(i*w2)+j] = pixels[(y2*w1)+x2] ;
}
}
return temp ;
}
>>
convert int.png -filter point -resize 200% out.png
>>
>>57968731
you're so fucking lazy i bet you play videogames

 for (int i=0;i<h2;i++)
{
int* t = temp + i*w2;
y2 = ((i*y_ratio)>>16);
int* p = pixels + y2*w1;
int rat = 0;
for (int j=0;j<w2;j++)
{
x2 = (rat>>16);
*t++ = p[x2];
rat += x_ratio;
}
}


another one in matlab:
function [ scaledImg ] = imgResize( inputImg, rows, cols, factor )
scaledImg=zeros(rows*factor,cols*factor);
tic
for i=1:(rows*factor)
for j=1:(cols*factor)
x=floor(i/factor);
y=floor(j/factor);
if x==0
x=1;
end
if y==0
y=1;
end
scaledImg(i,j) = inputImg(x,y);
end
end
toc
figure(1);imshow(inputImg, []);
figure(2);imshow(scaledImg, []);
end


another one in c sharp:
ublic static Bitmap NearestNeighborScale(Bitmap bmp, int newXSize, int newYSize)
{
if (newXSize == 0 || newYSize==0)
throw new ImageException(\"New dimensions cannot be zero for scaling!\");

Bitmap newBMP = new Bitmap(newXSize, newYSize);
int w1 = bmp.Width;
int h1 = bmp.Height;

// EDIT: added +1 to account for an early rounding problem
int x_ratio = (int)((w1 << 16) / newXSize) + 1;
int y_ratio = (int)((h1 << 16) / newYSize) + 1;

int x2, y2;
for (int i = 0; i < newYSize; i++)
{
for (int j = 0; j < newXSize; j++)
{
//Get the source position of the pixel
x2 = ((j * x_ratio) >> 16);
y2 = ((i * y_ratio) >> 16);
newBMP.SetPixel(j, i, bmp.GetPixel(x2, y2));
}
}
return newBMP;
}


another one in matlab:
scale = [2 2];             
oldSize = size(inputImage);
newSize = max(floor(scale.*oldSize(1:2)),1);

rowIndex = min(round(((1:newSize(1))-0.5)./scale(1)+0.5),oldSize(1));
colIndex = min(round(((1:newSize(2))-0.5)./scale(2)+0.5),oldSize(2));

outputImage = inputImage(rowIndex,colIndex,:);


these are all from google, cocknibbler. captcha: even downs
Thread posts: 6
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.