<div dir="ltr">Hi,<div><br></div><div>I'm trying to read an RGB image using GDAL. I have got it working, but my image is upside down. This is the code I am using for that:</div><div><br></div>CPLErr err = geotiffDataset->RasterIO(<br>            GF_Write,<br>            0, 0,<br>            _image->s(), _image->t(),<br>            (void *)(_image->data()),<br>            _image->s(), _image->t(),<br>            cvtGLtoGDALType(_image),<br>            3, NULL,<br>            _image->getPixelSizeInBits() / CHAR_BIT , _image->getRowStepInBytes(), _image->getPixelSizeInBits() / 3 / CHAR_BIT<br><div>        );</div><div><br></div><div>But, if I try to use negative nLineSpace to flip it vertically:</div><div><br></div><div> CPLErr err = geotiffDataset->RasterIO(<br>            GF_Write,<br>            0, 0,<br>            _image->s(), _image->t(),<br>            (void *)((char *)_image->data() + _image->getImageSizeInBytes() - _image->getRowStepInBytes()),<br>            _image->s(), _image->t(),<br>            cvtGLtoGDALType(_image),<br>            3, NULL,<br>            _image->getPixelSizeInBits() / CHAR_BIT , -_image->getRowStepInBytes(), _image->getPixelSizeInBits() / 3 / CHAR_BIT<br>        );</div><div><br></div><div>I get a segfault.<br clear="all"><div><br></div><div>Image is 1024x1024x3 and GDT_Float32. Anyone has any idea if I made a mistake? Am I going about this wrong?<br></div><div><br></div><div>Thanks to everybody in advance.</div><div><br></div><div>Cheers,</div><div><br></div><div>Omar.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
  
    
    
    
    
    
    
    
  
  
  <div style="color:#1a1a1a;font-family:Source Sans Pro,Arial,sans-serif!important">
    <table>
    <tbody><tr><td style="font-family:Source Sans Pro,Arial,sans-serif!important">         

                <table style="display:block;padding:5px 10px;color:#1a1a1a;font-size:14px">
                <tbody><tr>
                        <td style="font-family:Source Sans Pro,Arial,sans-serif!important"><a href="https://cinfo.es/?utm_source=mailing&utm_medium=logo&utm_campaign=trafico-generico&utm_content=index" style="color:#7c7c7c" target="_blank"><div style="text-align:left;margin-top:10px"><img width="100" height="auto" style="padding-left:10px;width:100px" src="https://www.cinfo.es/wp-content/uploads/2019/06/logocinfo.png" alt="logo cinfo" title="logo cinfo"></div></a></td>
                </tr>
                <tr>
                        <td style="font-family:Source Sans Pro,Arial,sans-serif!important">
                                <table>
                                <tbody><tr>
                                        <td width="33" style="display:inline-block;padding:0;width:33px;border-collapse:collapse;font-family:Source Sans Pro,Arial,sans-serif!important"></td>
                                        <td width="100%"> <h3 style="font-size:18px;margin:0">Luis Omar Álvarez Mures</h3><h5 style="font-size:13px;margin:0">AI Software Development Coordinator</h5>
                                        <p style="font-size:12px;color:grey;font-family:Source Sans Pro,Arial,sans-serif!important;color:#7c7c7c"> <a href="mailto:omar.alvarez@cinfo.es" style="color:#7c7c7c" target="_blank"> omar.alvarez@cinfo.es</a> | +34  881 015 512<br>Edificio CITIC 2 - Antonio Insua Rivas, 56 - 15008 A Coruña (ES) (<a href="https://goo.gl/maps/KbSUu5Pz9KArD8cD8" style="color:#7c7c7c" target="_blank">ver mapa</a>)<br><a href="https://www.cinfo.es" style="color:#7c7c7c" target="_blank">https://www.cinfo.es</a>
                                        </p>
                                        </td>
                                </tr>
                                </tbody></table>
                        </td>
                </tr>
                </tbody></table>
                
                <table cellspacing="0" cellpadding="0" border="0" width="auto" style="width:auto!important;display:block;background:#e30613;height:1px;margin:10px 0">
                   <tbody><tr>
                          <td width="100%" bgcolor="#e30613" height="1" style="font-size:1px;line-height:1px;font-family:Source Sans Pro,Arial,sans-serif!important"> </td>
                   </tr>
                </tbody></table>
                
                        
                <table style="margin-top:10px">
                <tbody><tr>
                        <td style="font-size:12px;font-family:Source Sans Pro,Arial,sans-serif!important">                
                        <p style="color:grey;font-family:Source Sans Pro,Arial,sans-serif!important">CONFIDENCIALIDAD Y PROTECCIÓN DE DATOS</p>
                        <p style="color:grey;font-family:Source Sans Pro,Arial,sans-serif!important">Este envío es <strong>privado y confidencial</strong>, estando destinado únicamente a la persona a la que ha sido enviado. Si usted no es el destinatario al que ha sido remitido, no puede copiar la información, distribuirla ni emprender con ella ningún tipo de acción. Si cree que lo ha recibido por error, por favor, <strong>notifíquelo al remitente y proceda a su eliminación</strong>.</p><p style="color:grey;font-family:Source Sans Pro,Arial,sans-serif!important">

                        <strong>Información Básica de Protección de Datos. Responsable:</strong> CINFO CONTENIDOS INFORMATIVOS ESPECIALIZADOS, S.L. (B15757941) C/Antonio Insua Rivas 56,15008 Coruña.<strong>Finalidad:</strong> Inicio o mantenimiento de la relación profesional. Envío de información, respuesta a consultas y contactos genéricos. <strong>Legitimación:</strong> Consentimiento del interesado. <strong>Destinatarios:</strong> No se cederán datos a terceros salvo obligación legal. <strong>Derechos:</strong> Tiene derecho de acceso, oposición, limitación, supresión, oposición y portabilidad de sus datos, mediante carta a la dirección postal indicada o enviando un email a <a href="mailto:gdpr@cinfo.es" style="color:#7c7c7c" target="_blank">gdpr@cinfo.es</a>. <strong>Si no quiere recibir envíos comerciales escriba a: <a href="mailto:gdpr@cinfo.es" style="color:#7c7c7c" target="_blank">gdpr@cinfo.es</a> Para más información sobre el uso de los datos, visite:</strong> <a href="https://www.cinfo.es/es/politica-privacidad/" style="color:#7c7c7c" target="_blank">https://www.cinfo.es/es/politica-privacidad/</a></p>
                        </td>
                </tr>
                </tbody></table>
    
    
  </td></tr> 
  </tbody></table>
</div>
</div></div></div>