| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -181,7 +181,7 @@ int stbi_write_tga(char const *filename, int x, int y, int comp, const void *dat | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   int has_alpha = !(comp & 1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   int colorbytes = comp - has_alpha; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 3, 1 color channel (Y/YA) = 2
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   if (format == 2) colorbytes = 3;     // is 2 color channels (RG/RGA) even possible? write as RGB/RGBA
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					   return outfile(filename, -1,-1, x, y, comp, (void *) data, has_alpha, 0, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					                  "111 221 2222 11", 0,0,format, 0,0,0, 0,0,x,y, (colorbytes+has_alpha)*8, has_alpha*8); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				 | 
				
					
  |